enh: Replace Peewee with SQLAlchemy due to multithreading issues #1282

Closed
opened 2025-11-11 14:41:47 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @jonathan-rohde on GitHub (Jun 17, 2024).

Is your feature request related to a problem? Please describe.
When using the application, the database connection gets still sooner or later. The root cause relies here in the multithreaded environment of FastAPI

Describe the solution you'd like
Replace Peewee ORM with SQLAlchemy

Describe alternatives you've considered
There exists a possibility to do an auto-reconnect for certain db related errors. But in my opinion this just hides the real issue. In some cases it might solve the users need, but it is not very reliable.
Additional there is a peewee-async project that can handle it. But reworking the backend to fit the async dependency is just at least the same effort as replacing it with SQLAlchemy. Considering if a library will be maintained in the future, I would rather bet with SQLAlchemy than peewee-async

Additional context
Screenshot 2024-06-17 at 10 42 21
https://github.com/tiangolo/fastapi/issues/1019#issuecomment-612921599

Originally created by @jonathan-rohde on GitHub (Jun 17, 2024). **Is your feature request related to a problem? Please describe.** When using the application, the database connection gets still sooner or later. The root cause relies here in the multithreaded environment of FastAPI **Describe the solution you'd like** Replace Peewee ORM with SQLAlchemy **Describe alternatives you've considered** There exists a possibility to do an auto-reconnect for certain db related errors. But in my opinion this just hides the real issue. In some cases it might solve the users need, but it is not very reliable. Additional there is a peewee-async project that can handle it. But reworking the backend to fit the async dependency is just at least the same effort as replacing it with SQLAlchemy. Considering if a library will be maintained in the future, I would rather bet with SQLAlchemy than peewee-async **Additional context** ![Screenshot 2024-06-17 at 10 42 21](https://github.com/open-webui/open-webui/assets/165899591/2665305e-c0fd-4b54-bd92-2c0841343bac) https://github.com/tiangolo/fastapi/issues/1019#issuecomment-612921599
GiteaMirror added the enhancementgood first issuehelp wantedcore labels 2025-11-11 14:41:47 -06:00
Author
Owner

@tjbck commented on GitHub (Jun 17, 2024):

PR welcome!

@tjbck commented on GitHub (Jun 17, 2024): PR welcome!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1282