Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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: UI/UX:

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.

Change History (3)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Working as designed. Django doesn't support running a single query across two different databases; this is documented behavior.

comment:2 Changed 5 years ago by IsakovAN

No problem, but how can I tell Django to separate queries?

comment:3 Changed 5 years ago by russellm

If you have usage questions, please direct them the to django-users.

Note: See TracTickets for help on using tickets.
Back to Top