sqlalchemy, select using reverse-inclusive (not in) list of child column values
The notin_ works for me, adjusted example:
db.session.query(Post).filter(Post.tags.notin_(['dont','want','these']))
Pretty straightforward using negated any
:
query = session.query(Post).filter(~Post.tags.any(Tag.name.in_(['dont', 'want', 'these'])))
Try this one, easy:
users = session.query(Post).filter(not_(Post.tags.name.in_(['dont', 'want', 'these'])))
Hope this helps!