Wiz
Wiz

Reputation: 4865

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.

Upvotes: 10

Views: 6935

Answers (1)

David Wolever
David Wolever

Reputation: 154494

You can add an order_by clause:

query = query.order_by(MyTable.column_name)

Upvotes: 14

Related Questions