Hi! Or something like
s.query(A).filter(not_(A.column.in_(select(table_b.c.column)) David Empty napsal(a): > Hello Felix, > >> No I want to get all items from table A where no matching item in table B >> exists. I'm aware that this would be very easy if table A stores the >> foreign key. > > SQLAlchemy supports the NOT EXISTS syntax through the any() / has() > methods. You should be able to do something like this: > > session.query(A).filter(~A.b.any()) > > See http://www.sqlalchemy.org/docs/05/ormtutorial.html#datamapping_joins_using > for more information. > > Michael Trier > blog.michaeltrier.com > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---