Opened 13 years ago
Closed 13 years ago
#17701 closed New feature (needsinfo)
add an easy way to update database settings
Reported by: | Gabriel | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | charette.s@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently I have an application that connect to multiple databases, I'm using a default one for authentication and some configuration stuff, later authorized users can add others databases to connect to (using an admin app) and I'm saving it connect information in the default db.
I'm using a middleware to update and recreate the connections on every request.
It would be nice if there is an easy way to update or add a new connection on runtime.
Change History (3)
comment:1 by , 13 years ago
Cc: | added |
---|
comment:2 by , 13 years ago
comment:3 by , 13 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
This is an interesting setup to say the least :)
However, like akaariai says, this ticket is missing a concrete proposal. This would be a major refactor of django.db
, and I'm skeptical on the value added.
If you want this feature in Django, you should study how it could be implemented, determine what advantages it would have besides catering for your use-case, and propose an API on the django-developers mailing-list.
I think this one needs a bit more information about what exactly is wanted. If the only request is to create dynamically new DB aliases like the ones in settings.DATABASES I think that could be somewhat easily implemented. I am not sure at all if it is a good idea to actually include such implementation in Django.
Do you have a proposed API? Something like create_new_dbalias(alias, settings)?
If I am not mistaken you could do the above by just mucking with the django.conf.settings in the middleware. Changing the settings in-flight isn't usually the best of ideas, but I think it might work here.
As is, it is hard to review this ticket.