Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLAlchemy alphabetical ordering query

Is there a way to order the rows returned by a SQLAlchemy query alphabetically in the actual query, or is the only way to order alphabetically is to sort the list of rows that the query returns.

like image 544
Wiz Avatar asked Oct 11 '12 00:10

Wiz


1 Answers

You can add an order_by clause:

query = query.order_by(MyTable.column_name)
like image 164
David Wolever Avatar answered Nov 14 '22 08:11

David Wolever