On Sep 28, 2008, at 5:09 PM, adolfo wrote:
> > Lets say we have this pattern > > Tables A make a reference to B, and both makes a reference to P > > A -> B > > A -> P > B -> P > > I need 2 aliases of P to make a query having conditions against P > > P1 = aliased(P) > P2 = aliased(P) > > Now I make a query, with outerjoins > > session.query(A).outerjoin(B).outerjoin(A.p).outerjoin(B.p) > > where we assume that A.p and B.p point to some P > > BUT I need an alias if I want to filter the former expression. > > So I'm trying to do > > session.query(A).outerjoin(B).outerjoin(P1, A.p).outerjoin(P2, B.p) an individual "outerjoin" call always joins on the left side to the entities which the Query is against, in this case "A". I think you mean to say: session.query(A).outerjoin((P1, A.p)).outerjoin(A.b, (P2, B.p)) note the tuples are required for any kind of (right side of join, onclause) expression. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
