upvote
+1 to this - I've griped pretty often that FastAPI's documentation implicitly recommends this (https://fastapi.tiangolo.com/tutorial/sql-databases/#create-...) by suggesting using dependency injection to manage database connections, only to start seeing connection pool exhausted errors as soon as the number of concurrent requests exceeds the number of allowed connections.
reply
Oh wow. Dep injection for DB connections is nasty.
reply
I might be outing myself as a noob here, but... what is the (better) alternative?
reply
You inject the pool itself.
reply