prasad-madine commented on code in PR #47440:
URL: https://github.com/apache/airflow/pull/47440#discussion_r1984973486
##########
airflow/api_fastapi/common/parameters.py:
##########
@@ -201,16 +219,30 @@ def to_orm(self, select: Select) -> Select:
# MySQL does not support `nullslast`, and True/False ordering depends
on the
# database implementation.
nullscheck = case((column.isnot(None), 0), else_=1)
+
+ return (nullscheck, column.desc() if order_by.startswith("-") else
column.asc())
+
+ def to_orm(self, select: Select) -> Select:
+ if self.skip_none is False:
+ raise ValueError(f"Cannot set 'skip_none' to False on a
{type(self)}")
+
+ if self.value is None:
+ self.value = self.get_primary_key_string()
+
+ order_by_list = self.value.split(",") if self.value else []
+
+ order_by_columns = self.get_order_by_columns(order_by_list)
# Reset default sorting
select = select.order_by(None)
- primary_key_column = self.get_primary_key_column()
-
- if self.value[0] == "-":
- return select.order_by(nullscheck, column.desc(),
primary_key_column.desc())
+ if order_by_columns:
+ select = select.order_by(*[col for pair in order_by_columns for
col in pair])
else:
- return select.order_by(nullscheck, column.asc(),
primary_key_column.asc())
+ primary_key_column = self.get_primary_key_column()
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]