Let's assume there is a foreign key A.fk -> B.id from table A to table
B, and these tables and columns are mapped to corresponding classes.
Then let's translate the foreign key to a reference A.ref -> B via a
relation.

We can easily join B onto A: session.query(A).join("ref") or
session.query(A).join(A.ref).

Joining in the opposite direction is much uglier: session.query(B).join
((A, A.fk == B.id)). It seems to need the basic foreign key column fk
(if it is mapped). Is there a way to express this using only the
relation? Something like session.query(B).join((A, A.ref == B)) or any
notation like session.query(B).join((A, A.ref == B.self)) perhaps?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to