Reputation: 271
I'm using Django + internal database(mysql). but, I need to query to another external database(mysql). In case, Can I make to model of external database? The database is already exist. Only need to query.. Thank you.
Upvotes: 4
Views: 6519
Reputation: 19399
I think you'll need to take a look at this documentation. It explain how to register multi databases and then query from them. https://docs.djangoproject.com/en/dev/topics/db/multi-db/ To be specific from which DB you query you can jump to this part of the docs https://docs.djangoproject.com/en/dev/topics/db/multi-db/#manually-selecting-a-database-for-a-queryset
Upvotes: 2