6
SQLAlchemy按降序排列?
如何descending在如下所示的SQLAlchemy查询中使用ORDER BY ? 此查询有效,但以升序返回: query = (model.Session.query(model.Entry) .join(model.ClassificationItem) .join(model.EnumerationValue) .filter_by(id=c.row.id) .order_by(model.Entry.amount) # This row :) ) 如果我尝试: .order_by(desc(model.Entry.amount)) 然后我得到:NameError: global name 'desc' is not defined。
424
python
sqlalchemy