[sqlalchemy] Re: ORM and EXISTS?

2009-09-14 Thread Seppo11
On 11 Sep., 22:12, Conor wrote: > This query will get you close to your desired SQL: > q = session.query(ATable) > q = q.filter( >     sa.exists( >         [1], >         ((BTable.atable_id == ATable.id) >          & (CTable.cval.in_(["foo", "bar"]))), >         from_obj=orm.join(BTable, CTable))

[sqlalchemy] ORM and EXISTS?

2009-09-10 Thread Seppo11
Hi! I'm having trouble getting a query to work. The query looks rather simple but I can't manage to build it using sqlalchemy - especially I didn't find a way for the exists clause to build. The query (simplified): SELECT * from ATable WHERE EXISTS ( SELECT 1 FROM BTable join CTable on BTable