python-dependency-injector icon indicating copy to clipboard operation
python-dependency-injector copied to clipboard

best setup with sqlalchemy and connection pooling

Open theobouwman opened this issue 2 years ago • 1 comments

Will this example (https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/fastapi-sqlalchemy) be a production ready setup with connection pooling etc?

theobouwman avatar May 02 '23 22:05 theobouwman

I'm not completely certain, but based on my intuition, it seems that the solution may not be production-ready. This is because FastAPI is an asynchronous framework, but in this example, SQLAlchemy is used in a synchronous manner. As a result, any database calls made will block the event loop.

See https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html

Can anyone provide clarification or correct me if I'm mistaken?

lucassus avatar May 30 '23 07:05 lucassus