#13964 closed (invalid)
Database router ignore
| Reported by: | IsakovAN | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.2 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
class A(models.Model):
...
class B(models.Model):
a = models.ForeignKey(A)
...
Database router set DIFFERENT databases for reading for this classes and allowing relations.
B.objects.all() result:
SELECT ... FROM A_table LEFT OUTER JOIN B_table ON ... ORDER BY ... ASC';
So it trying to read both related objects from one database ignoring router.
Note:
See TracTickets
for help on using tickets.
Working as designed. Django doesn't support running a single query across two different databases; this is documented behavior.