#13053: Support for non-static DB connection info
------------------------------------------+---------------------------------
 Reporter:  Lynge                         |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  SVN       
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 It would be great if we could specify a class or function as the source of
 the DB-connection information.

 I am thinking something like:

 {{{
 DATABASES = {
     'default': {
         'INFO_FINDER': 'myproject.myDBFinderApp.MyDBFinder',
     },
     'users': {
         'NAME': 'user_data',
         'ENGINE': 'django.db.backends.mysql',
         'USER': 'mysql_user',
         'PASSWORD': 'priv4te'
     }
 }
 }}}

 This would then get executed every time something was needed from the
 'default' DB.

 Where would this be useful?
 In my current project I am building a webapp where each client gets their
 own subdomain and is free to create users inside it. It would be very
 useful to shard data by this subdomain since my clients never have to
 communicate via the webapp. This means that I have to be able to create a
 new DB and connect to it whenever a new client signs up. This is not
 possible with the current setup using settings.py.

 This method of dividing clients is not new at all so I guess there is many
 more than myself that will benefit from this, but more importantly (I
 think) is that it will most likely cover any other corner-case that Django
 is not capable of, since it will be so easy to just write your own
 DBFinder and link it. Any DBFinder will, of course, have to always return
 the connection info in the correct format just like to one normally used
 in settings.

 I have tried to do it myself, but I just cant make any sense of it and
 have no idea where to do the check to see if settings give connection-info
 or just a place to get it.
 But I cannot imagine it would be any huge amount of work for the people
 who wrote the thing or just about anyone with greater skills in Django-
 development than my own.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13053>
Django <http://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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to