[sqlalchemy] Re: subquery using the ORM

2007-04-23 Thread Karthik Krishnamurthy
I don't have a very good idea about that. But I do know the query I have used works. Still hoping somebody has an idea of how to achieve that using the ORM. Or maybe I should be using a select and then mapping it. /kk On 4/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: sorry for my

[sqlalchemy] Re: subquery using the ORM

2007-04-23 Thread Michael Bayer
assuming a reasonable mapping (i.e. the m2m example in the datamapping docs) session.query(Node).select(and_( nodes.c.id.in_(select([group_nodes.c.node_id], group_nodes.c.group_id==1, correlate=False), nodes.c.id.in_(select([group_nodes.c.node_id], group_nodes.c.group_id==2,