mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
enh: Replace Peewee with SQLAlchemy due to multithreading issues #1282
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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

https://github.com/tiangolo/fastapi/issues/1019#issuecomment-612921599
@tjbck commented on GitHub (Jun 17, 2024):
PR welcome!