Fix Python – Group by & count function in sqlalchemy


Asked By – Nazmul Hasan

I want a “group by and count” command in sqlalchemy. How can I do this?

Now we will see solution for issue: Group by & count function in sqlalchemy


The documentation on counting says that for group_by queries it is better to use func.count():

from sqlalchemy import func

This question is answered By – miniwark

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0