#33578: How feasible is modifying the django.db.connections object at run time
for
a multitenant system which uses isolated databases for tenancy
-------------------------------------+-------------------------------------
Reporter: mukilr | Owner: nobody
Type: New | Status: new
feature |
Component: Database | Version: 4.0
layer (models, ORM) |
Severity: Normal | Keywords: dbrouter
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have a FastAPI based application for which I am using the Django ORM to
access the databases. And Im using the starlette-config dependency to
manage the request context including the database details which will be
part of the request.
I am currently updating the django.db.connections.databases object on the
fly in a FastAPI middleware as detailed here:
https://stackoverflow.com/a/28891429/2324527
After this, Im using a custom database router to select the newly added
database for performing the database operation. Is this method feasible
for production?
If so, do we have a more streamlined approach that could be introduced so
that django supports dynamic database switching on the fly?
--
Ticket URL: <https://code.djangoproject.com/ticket/33578>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107017f8dfc56e7-952bf9b4-5e02-4400-81a3-9ea6666dc16c-000000%40eu-central-1.amazonses.com.