filtering by association attributes with SqlAlchemy association_proxy

后端 未结 2 698
日久生厌
日久生厌 2021-02-05 19:23

I have a many-to-many (developers & projects) relationship modeled using SA\'s association_proxy. The collections (developers on each project & project

2条回答
  •  野性不改
    2021-02-05 20:10

    Use any() method of association proxy:

    s.query(Developer).filter(Developer.developerProjects.any(status='active'))
    

提交回复
热议问题