Categories
How to translate such a command into sqlalchemy?
SELECT dest , COUNT( dest ) FROM lan GROUP BY `dest` ORDER BY COUNT( dest ) DESC LIMIT 0, 30
Answer the question
In order to leave comments, you need to log in
query = session.query(LanModel.dest, func.count(LanModel.dest)).group_by(LanModel.dest) query = query.order_by(LanModel.dest.desc()) query = query.limit(30) objs = query.all()
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question