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))
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