pierrejeambrun commented on code in PR #42782:
URL: https://github.com/apache/airflow/pull/42782#discussion_r1794907791
##########
airflow/api_fastapi/parameters.py:
##########
@@ -148,17 +150,29 @@ def depends(self, dag_display_name_pattern: str | None =
None) -> _DagDisplayNam
return self.set_value(dag_display_name_pattern)
+# SortParam Implementations
class SortParam(BaseParam[str]):
"""Order result by the attribute."""
attr_mapping = {
"last_run_state": DagRun.state,
"last_run_start_date": DagRun.start_date,
+ "connection_id": Connection.conn_id,
+ "conn_type": Connection.conn_type,
+ "description": Connection.description,
+ "host": Connection.host,
+ "port": Connection.port,
+ "id": Connection.id,
Review Comment:
Most of them you don't need. Things will fallback to the `self.model.column`
automatically.
```
getattr(
self.model, lstriped_orderby
)
```
We only need to use the `mapping` if the attribute is on a related / joined
table, and not on the defualt `model` one. Those might comme later but are not
required at the moment.
--
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]