s3rius / FastAPI-template

Feature rich robust FastAPI template.
MIT License
1.9k stars 164 forks source link

Change psycopg dependencies #107

Closed chandr-andr closed 2 years ago

chandr-andr commented 2 years ago

Hello! I found out that in the case of using psycopg dependency in a view, a situation is possible when the connection is allocated, but not used.

For example, if we need to execute a request for some third-party service before requesting the database.

Therefore, I suggest not taking the connection in dependency, but return the connection pool so that it is necessary to explicitly occupy the connection when it is needed