title: create database for each Django Model instance
body: <p>I have one "master Model" with lots of "children Models" :
  As i know there will be a lot of data (through children), i would like to store dynamically each new instance of that MasterModel in a separated database (with all its children)</p>
  
  <pre><code>class MasterModel(models.Model):
      name = models.CharField()
      #db_connexion_name='mastermodel_1_db'
  
  class ChildModelA(models.Model):
      mastermodel = models.ForeignKey(MasterModel)
  class ChildModelB(models.Model):
      mastermodel = models.ForeignKey(MasterModel)
      child = models.ManyToManyField(ChildModelA)
      child = models.ManyToManyField(ChildModelA)
      class ChildModelC(models.Model):
      ...
  </code></pre>
  
  <p>There is a lot of childs and relationships, but never between MasterModel objects</p>
  
  <p>From now on, i guess i have to do :
  For each new MasterModel instance (by overriding the save() method):</p>
  
  <ol>
  <li>dynamically update settings.DATABASES dictionnary to add a new database : 'mastermodel_1_db', 'mastermodel_2_db'</li>
  <li>syncdb (to create schema / tables) on that db</li>
  <li>and then use a custom DatabaseRouter manage db transactions</li>
  </ol>
  
  <p>like this:</p>
  
  <pre><code>class MyDatabaseRouter(object):
      def db_for_read() / db_for_write() / ... :
          # for any model, return the database
          # of the mastermodel related object
          # like :
          if hasattr(model,'mastermodel'):
              return model.mastermodel.db_connexion_name
  </code></pre>
  
  <p>Am i on the right way ?</p>