Another issue with this relation is that it doesn't like being eagerloaded.
Using the same model from my first post (with the broken backref
removed or fixed):
session.query(Child1).options(eagerload('left_child2')).first()
Generates the sql:
 SELECT anon_1.child1_id AS anon_1_child1_id, anon_1.parent_id AS
anon_1_parent_id, anon_1.parent_cls AS anon_1_parent_cls,
anon_2.child2_id AS anon_2_child2_id, anon_2.parent_id AS
anon_2_parent_id, anon_2.parent_cls AS anon_2_parent_cls
FROM (SELECT child1.id AS child1_id, parent.id AS parent_id,
parent.cls AS parent_cls, parent.oid AS parent_oid
FROM parent JOIN child1 ON parent.id = child1.id ORDER BY parent.oid
 LIMIT 1 OFFSET 0) AS anon_1 LEFT OUTER JOIN secondary AS secondary_1
ON anon_1.child1_id = secondary_1.right_id LEFT OUTER JOIN (SELECT
anon_1.child1_id AS anon_1_child1_id, anon_1.parent_id AS
anon_1_parent_id, anon_1.parent_cls AS anon_1_parent_cls, child2.id AS
child2_id
FROM (SELECT child1.id AS child1_id, parent.id AS parent_id,
parent.cls AS parent_cls, parent.oid AS parent_oid
FROM parent JOIN child1 ON parent.id = child1.id ORDER BY parent.oid
 LIMIT 1 OFFSET 0) AS anon_1 JOIN child2 ON anon_1.parent_id =
child2.id) AS anon_2 ON anon_2.child2_id = secondary_1.left_id ORDER
BY anon_1.oid, secondary_1.oid

Which fails with:
 (OperationalError) no such column: anon_2.parent_id

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to