[sqlalchemy] Re: Intersect of ORM queries

2008-03-05 Thread svilen
pardon my sql-ignorancy, but cant u express this in just one expression? it should be possible, it is a graph/set arithmetics after all... mmh, (could be very wrong!) something like - get all rows that has some b_id from the looked list - group(?) somehow by a_id, and then finger the a_id

[sqlalchemy] Re: Intersect of ORM queries

2008-03-05 Thread Michael Bayer
On Mar 5, 2008, at 10:50 AM, Eric Ongerth wrote: Anyway -- so what would really clean it all up would be: session.query(A).filter(A.bs.contains(list_of_bs_being_sought)).all(). THAT would do exactly what I'm trying to accomplish. But it would require contains() to accept a list and know

[sqlalchemy] Re: Intersect of ORM queries

2008-03-05 Thread Eric Ongerth
Cool. I wasn't sure if it was ready for filter(A.bs == list_of_bs). When I tried to do that before, I must have let some silly syntax error keep me from realizing that it was a workable construction. Thanks! On Mar 5, 8:20 am, Michael Bayer [EMAIL PROTECTED] wrote: On Mar 5, 2008, at 10:50