Skip to content

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.

1 participant