I have a class that I will call Child which inherits via join inheritance from a class I will call Parent. There is a many-to-many relationship between Child and a class that I will call Other.
A query that looks like this: child = <some child> Other.query.filter(not_(other.child_objects.contains(child))).first() Generates sql that looks like: SELECT <other columns> FROM other WHERE NOT (EXISTS (SELECT 1 FROM other_child, child, parent WHERE other.id = other_child.other_id AND child.id = other_child.child_id AND parent.id = %s)) ORDER BY other.id LIMIT 0, 1 The subquery (unnecessarily) includes the parent table. However, it does not join the parent table with the child table, so the subquery will always be true as long as there is any entry for the other in other_child, even if it is not with the child we care about. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---