sqlalchemy, select using reverse-inclusive (not in) list of child column values

前端 未结 4 1631
忘了有多久
忘了有多久 2021-02-02 10:30

I have a typical Post / Tags (many tags associated with one post) relationship in flask-sqlalchemy, and I want to select posts which aren\'t tagged with any tag in a list I prov

4条回答
  •  再見小時候
    2021-02-02 11:01

    The notin_ works for me, adjusted example:

    db.session.query(Post).filter(Post.tags.notin_(['dont','want','these'])) 
    

提交回复
热议问题