title: Getting data from multiple databases with same tablenames in django
body: <p>I need to get data from different imported MySQL-databases in Django 
  <em>(Django 1.11.7, Python 3.5.2)</em>.
  I run <code>manage.py inspectdb --database '&lt;db&gt;'</code> and then use the models in django.</p>
  
  <p>Until now, I only had to access tables with different names. For this purpose, I used the <code>using</code> keyword in the queryset to specify the appropriate database and then concatenated the result, like this:</p>
  
  <pre><code>from ..models.db1 import Members
  from ..models.db2 import Actor
  
  context['db1_data'] = Members.objects.using('db1').filter...
  context['db2_data'] = Actor.objects.using('db1').filter...
  
  context["member_list"] = list(chain(
      context["db1_data"],
      context["db2_data"],
  ))
  
  return context
  </code></pre>
  
  <p>Now I have the problem that there are tables with the same model names in two databases. I get the following error when using the above-mentioned method (I substituted the names):</p>
  
  <pre><code>RuntimeError: Conflicting '&lt;table-name&gt;' models in application '&lt;app&gt;': &lt;class '&lt;app&gt;.&lt;subfolder&gt;.models.&lt;db1&gt;.&lt;table-name&gt;'&gt; and &lt;class '&lt;app&gt;.&lt;subfolder&gt;.models.&lt;db2&gt;.&lt;table-name&gt;'&gt;.
  </code></pre>
  
  <p>I already tried importing the model with a different name, like this:</p>
  
  <pre><code>from ..models.db3 import Members as OtherMembers
  </code></pre>
  
  <p>but the error still comes up.</p>
  
  <p>Shouldn't <code>from ..models.db1</code> and <code>from ..models.db2</code> be clear enough for Django to spot the difference between the two models?</p>
  
  <p>One option would probably be to rename the models themselves, but that would mean to rename every database model with the same names. Since I will use many more databases in the future, this is not an option for me.</p>
  
  <p>I tried <code>from models import db1, db2</code> and then <code>db1.Members</code> etc., which still raises the error.</p>
  
  <p>I read about the meta <code>db_table = 'dbname.tablename'</code>-option, but since the model is auto-generated through <code>inspectdb</code>, it already has something like this on every class:</p>
  
  <pre><code>class MyModel(models.Model):
      &lt;models&gt;
  
      class Meta:
          managed = False
          db_table = 'my_model'
  </code></pre>
  
  <p>As described before, the other database has the exact same model and hence the same Meta classes. I can't and don't want to change every Meta class.</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My project structure looks like this:</p>
  
  <pre><code>app
      -&gt; admin.py
      -&gt; ...
      -&gt; models.py
      -&gt; views.py
      subfolder
          -&gt; models
              -&gt; db1.py
              -&gt; db2.py
          -&gt; views
              -&gt; db1.py
              -&gt; db2.py
  </code></pre>