Skip to content
Discussion options

You must be logged in to vote

If you are using standard pool, you will probably be able to set the pool limits using the parameters pool_size (by default is 5) and max_overflow (by default is 10): https://docs.sqlalchemy.org/en/20/core/engines.html#

But be careful, at some point you can reach the limit of your server.

Does writing something like db: Session = Depends(get_db) limit the number of concurrent requests?

It's SQLAlchemy's pool that does it when you call SessionLocal (in this case).

Is it better to post-acquire the database connection?

If you are talking about establishing new connection every time you need instead of using connection pool, then it's not very efficient way, because it takes time to estab…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants