mysql - How to Find Count After Join in SQLAlchemy -
i join multiple tables with:
session.query(r, rr, rrr).join(r).join(rr).all()
i tried:
session.query(func.count(r, rr, rrr)).join(r).join(rr)
however, not appear correct approach determining count tables.
i
len(session.query(r, rr, rrr).join(r).join(rr).all())
but ideally, won't have counts in memory.
if after count(*)
, below should work:
q = (session .query(func.count().label("cnt")) .select_from(r) .join(rr) .join(rrr) ) r = q.scalar()
Comments
Post a Comment