Suppose there is a SQL statement:
select * from A order by cola
In sqlalchemy, we can use this code:
session.query(A).order_by(asc(cola))
Now I want to use a "compound order by" in SQL:
select * from A order by cola, colb
Then how will I translate it into sqlalchemy code? Can I use:
session.query(A).order_by(asc(cola, colb))
Probably I can't do it like this.
I find I can do this:
session.query(A).order_by('cola, colb')
Then this problem will be solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With