Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple databases #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jlrobins
Copy link

@jlrobins jlrobins commented Jan 22, 2023

Add an additional layer of indirection within app.state so that a single fastapi app wishing to use multiple postgresql databases (via distinct DSNs) can work.

Otherwise the last one calling configure_asyncpg() wins and overwrites app.state.pool.

Now apps can declare multiple database handles with multiple calls to configure_asyncpg() with separate DSNs, then wire up separate Depends() according to which connection pool's transaction is needed for any particular route's parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant