Replies: 2 comments
-
I think you should be able to do something if you overwrite the It has access to the def get_session(self, request: Request) -> SessionT:
session = getattr(request.state, self.session_key, None)
if session is not None:
return cast(SessionT, session)
engine_mapping = request.app.state["tenant_engines"]
engine = request.headers["tenant_id"]
session = AsyncSession(bind=engine)
setattr(request.state, self.session_key, session)
return session |
Beta Was this translation helpful? Give feedback.
0 replies
-
Multi config is now supported. You can pass in a list of config objects when you create the extension. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently my app is set up with one database per tenant (plus a catalog db for storing metadata about tenants: db server, db name etc) and so fetching the db engine requires request state to determine what tenant db to use (e.g. hostname, header, path variable).
Is there a way for this to be achieved with advanced alchemy currently? I can't see any way of doing this without creating one
StarletteAdvancedAlchemy
instance per db engine - would this work as intended?Beta Was this translation helpful? Give feedback.
All reactions