Sorting
How to sort selection query results.
db.sort()
db.sort()Usage
[select query object].db.sort(db.[desc/asc]([column]))Parameters:
Example
&basic
db_model MyModel:
id = db.col(db.int, db.pk)
number = db.col(db.int)
column = db.col(...)
...
# Selects all rows in MyModel where the column "coumn" is set to "text".
# Sorts the rows in descending order by the column "number".
results = MyModel.db.get_by(column='text').db.sort(db.desc(MyModel.number))
...Last updated