Hello all, I'm puzzled as I cannot seem to do a pretty simple query: I have a many to many relationship (say from Vendor to Item) and want to get a list of all vendors which have no item.
The obvious: Vendor.query.filter(Vendor.items == []).all() does not work (it produce a query without any where clause). Also, Vendor.items.count doesn't exist. It would be nice if we could express things like: Vendor.query.filter(Vendor.items.count() == 0).all() Maybe I'm just not awake yet, but can someone enlighten me how to do that? On a related note, I've seen the following block in the documentation (in the Relation "Operators" section): # locate an address sql>>> address = session.query(Address).\ ... filter(Address.email_address=='[EMAIL PROTECTED]').one() ['[EMAIL PROTECTED]'] # use the address in a filter_by expression sql>>> session.query(User).filter_by(addresses=address).all() Is it a simple mistake in the docs or is it really valid? In the later case, shouldn't [collection attribute == single instance] be an invalid case since the new "contains", "has" and "any" operators appeared? Or is filter_by(x=y) not always equal to CurrentJoinPoint.x == y ? -- Gaƫtan de Menten http://openhex.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---