I am using two mysql schemas X and Y, both contains multiple tables but there is one table that has same name in both the schemas.
Both the schemas are as follows:
+--------------+--+--------------+
| X | | Y |
+--------------+--+--------------+
| name | | album_info |
+--------------+--+--------------+
| invite | | photo_info |
+--------------+--+--------------+
| photo | | photo |
+--------------+--+--------------+
| user_details | | temp |
+--------------+--+--------------+
Now, I want to query on both the tables but when I write the table structure in models.py file with same name it throws error/exception. I declared both table in routers.py file as below:
modelDatabaseMap = {
.
'photo': 'default',
.
.
.
'photo': 'y',
}
(X is my default schema). Declared i models.py as below:
class Photo(models.Model):
id = models.AutoField(db_column='ID', primary_key=True)
has_tagged_with = models.IntegerField()
has_reposted_with = models.IntegerField()
.
.
class Meta:
managed = False
db_table = 'photo'
class Photo(models.Model):
id = models.AutoField(db_column='ID', primary_key=True)
account_id = models.IntegerField()
p_id = models.IntegerField()
is_profile = models.IntegerField()
.
.
class Meta:
managed = False
db_table = 'photo'
Now, the ambiguity is first in name, in declaration in models.py and secondly in querying. I am stuck at how to query on both the tables separately through orm. Any help/lead about this would be helpful. Thanks in advance.