Complex SQLAlchemy Query


Collecting complex SQLAlchemy queries I’ve made.

# Get emails for users who are verified and are part of "org"

User.query.filter(User.verified and User.id.in_(
    OrganizationMember.query.filter_by(organization=org).with_entities(OrganizationMember.user_id)
    )).with_entities(User.email).all()