Hello,

rsvs = session.query(Reservation).filter(Reservation.email == 
em).filter(Reservation.newhosts == [] ).options(eagerload('newhosts')).all()

sqlalchemy.exc.InvalidRequestError: Can't compare a collection to an 
object or collection; use contains() to test for membership.

Well I can always do:

rsvs = session.query(Reservation).filter(Reservation.email == 
em).options(eagerload('newhosts')).all()


for r in rsvs:
     if r.newhosts != []:
         print r.id, 'newhosts', r.newhosts

or

for r in rsvs:
     if r.newhosts == []:
         print r.id, 'newhosts', r.newhosts


But, that's ugly like. So, the question is, is it possible to query for 
empty or non-empty collection?

Regards,
mk

--

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.


Reply via email to