How to dynamically change database in fastapi?

98 Views Asked by At

there are different databases for different users. so after I extract the user from the api token, I want to switch my from my public database to the user database like how THREAD_LOCAL.DB = dbname works in django. I am currently using tortoise orm to manage the database connection. Is there a way to achieve that with tortoise or any other orm?

.

0

There are 0 best solutions below