You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: from sqlalchemy import func
In [2]: from db.models import Group, GroupMember
In [3]: from db.models.utils import Session
In [4]: session = Session()
In [5]: session.query(
Group.name, func.count(GroupMember.id).label('member_count')
).join(GroupMember).group_by(Group.name).first()._asdict()
Out[5]: {'name': 'DevOps Team', 'member_count': 1}