hi, > The parser will see expressions for A first, B, and then C, > I would like to do something like the following in sequence but not > necessarily at the same time. > > q = session.query(A).filter (A.name == 'boo') > q = session.query(B).filter (B.parent_id == q && B.value == 1) > q = session.query (C).filter (C.parent_id == q) > > which would generate something like: > > select id from ctable where ctable.parent_id in > ( select id from btable where btable.value =1 and > btable.parent_id in > ( select id from atable where atable.name = 'boo')) > > ## >
it seems to me that the following would do (almost) the same task: q = session.query( C).filter( and_( C.parent_id == B.id, B.value == 1)) q = q.filter( and_( B.parent_id == A.id, A.name == 'boo')) regards, stefan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
