appA is on project A.
appB is on project B.

--


As it turns out, migrate names the tables as [app]_[model_name] and thus 
with different app names on different projects, I was initially accessing 
the table migrate --database=created.

To access the table on another server, match the table names on both 
database servers by using in models.py:

class Meta:
    app_label = [app1_this]
    db_table = [app_another]_[model_name]

If someone else has a better solution, please let me know.


On Wednesday, July 19, 2017 at 12:21:53 AM UTC+8, Avraham Serour wrote:
>
> import the Model and query it.
>
> from appB.models import Table
> Table.objects.all()
>
>
> On Tue, Jul 18, 2017 at 6:01 PM, miguel vfx <[email protected] 
> <javascript:>> wrote:
>
>> Hello,
>>
>> After following through the documentation, I was able to query data from 
>> another database. However, I was only able to access the table of the same 
>> app name. How can I query data from a different app name?
>>
>> For example:
>> appA has a model client_data. It's table name in the app_db database is 
>> appA_client_data.
>>
>> In appB, I created the same model then when I query the data from appA, I 
>> get zero results because it's querying data from appB_client_data in 
>> appA_db.
>>
>> How do I query client_data table/model of appA_db from appB (Both are on 
>> different projects)
>>
>> Thank you for your time.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d7e05187-a93d-4b81-88f6-caeb652780b4%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/d7e05187-a93d-4b81-88f6-caeb652780b4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a873486-dedd-4051-8bb1-2100d737f035%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to