SQLAlchemy ORDER BY DESCENDING? -


how can use order descending in sqlalchemy query following?

this query works, returns them in ascending order:

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 :)         ) 

if try:

.order_by(desc(model.entry.amount)) 

then get: nameerror: global name 'desc' not defined.

just fyi, can specify things column attributes. instance, might have done:

.order_by(model.entry.amount.desc()) 

this handy since can use on other places such in relation definition, etc.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

c# - How to execute a particular part of code asynchronously in a class -

c# - Asterisk click to call -