How to add a dynamic ASC DSC Clause #1580
Closed
quillwithones
started this conversation in
General
Replies: 1 comment
-
you can use # order_by being "asc" or "desc"
query = sql.SQL(
"""
SELECT
...
ORDER BY {sort_by} {direction}
"""
).format(
sort_by=sql.Identifier(sort_by),
direction=sql.SQL(order_by)
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Sql.indentifier or sql.litral is not working to add a sql clause
Is that any alternative without doing like this
Beta Was this translation helpful? Give feedback.
All reactions