Opened 14 years ago

Closed 14 years ago

Last modified 14 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: 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.

Change History (3)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: invalid
Status: newclosed

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

comment:2 by IsakovAN, 14 years ago

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

comment:3 by Russell Keith-Magee, 14 years ago

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

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