Multiple databases #400
-
Hi, Does beanie supports working with multiple databases ?
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
In the provided snippet, all instances of
|
Beta Was this translation helpful? Give feedback.
-
@roman-right I'm using multitenant-architecture and this setup you have provided is working fine, unless we have a concurrent requests, to reproduce it, you can set up two simple endpoints (FastAPI) that deal with 2 different databases, then you can try to set up postman runner to make concurrent requests. In this case we endpoint with the following error: raise InvalidOperation("Can only use session with the MongoClient that started it") Additionally calling |
Beta Was this translation helpful? Give feedback.
-
@roman-right any updates on this? |
Beta Was this translation helpful? Give feedback.
-
I suggest Django approach could be good for adoption. I mean DB mapping and use .using('db_map_name') in queries. |
Beta Was this translation helpful? Give feedback.
Hi,
There is no "good practice" option for this now. I'm working on a new initializer atm - plan to add db swaps there.