#1142: Support for multiple database connections
---------------------------------------------------+------------------------
          Reporter:  Simon Willison                |         Owner:  Alex       
              
            Status:  new                           |     Milestone:             
              
         Component:  Database layer (models, ORM)  |       Version:             
              
        Resolution:                                |      Keywords:  multiple 
database feature
             Stage:  Accepted                      |     Has_patch:  1          
              
        Needs_docs:  1                             |   Needs_tests:  0          
              
Needs_better_patch:  1                             |  
---------------------------------------------------+------------------------
Comment (by nicktank):

 Replying to [comment:66 alexkoshelev]:
  I've implemented this on a development version of django 1.1.  It appears
 as though it appends the table name of the app in the database established
 in the project settings instead of adding the model's tables to the
 declared database
 {{{

 from django.db import models
 from django.blocks.apps.core.managers import MultiDBManager

 class FireMap(models.Model):
     address = models.CharField(max_length=100)
     city = models.CharField(max_length=50)
     zip = models.IntegerField()
     latitude = models.DecimalField(max_digits=17, decimal_places=14)
     longitude = models.DecimalField(max_digits=17, decimal_places=14)
     neighborhood = models.CharField(max_length=30)
     assesorID = models.IntegerField()
     assessorURL = models.URLField()
     homeValue = models.CommaSeparatedIntegerField(max_length=8)
     homeOwner = models.CharField (max_length=30)
     mainIMGURL = models.URLField()
     photos = models.CommaSeparatedIntegerField(max_length=40)
     articleID1 = models.IntegerField()
     articleID2 = models.IntegerField()
     articleID3 = models.IntegerField()
     extrainfo = models.TextField()

     objects = MultiDBManager()

     def __str__(self):
         return self.name

     class Meta:
         db_name = 'firemap'
 }}}

 the setting for the Db in my project settings file is set to:

 {{{

 DATABASE_ENGINE = 'postgresql_psycopg2'           # 'postgresql_psycopg2',
 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
 DATABASE_NAME = 'newsok'             # Or path to database file if using
 sqlite3.

 }}}

 When the tables are created I see in the newsok Db a firemap_firemap table
 (firemap is the name of the app as well) but there is nothing in the
 actual firemap Db.

 I apologize if this isn't the place to report this issue.  I am new around
 here and to django in general.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/1142#comment:72>
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-updates@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