jason810496 commented on code in PR #42959:
URL: https://github.com/apache/airflow/pull/42959#discussion_r1805888343
##########
airflow/api_fastapi/routes/public/dags.py:
##########
@@ -95,6 +98,31 @@ async def get_dags(
)
+@dags_router.get(
+ "/tags",
+ responses=create_openapi_http_exception_doc([401, 403]),
+)
+async def get_dag_tags(
+ limit: QueryLimit,
+ offset: QueryOffset,
+ order_by: QueryDagTagOrderBy,
+ tag_name_pattern: QueryDagTagPatternSearch,
+ session: Annotated[Session, Depends(get_session)],
+) -> DAGTagCollectionResponse:
+ """Get all DAG tags."""
+ base_select = select(distinct(DagTag.name))
+ dag_tags_select, total_entries = paginated_select(
+ base_select=base_select,
+ filters=[tag_name_pattern],
+ order_by=order_by,
+ offset=offset,
+ limit=limit,
+ session=session,
+ )
+ dag_tags = session.execute(dag_tags_select).scalars().all()
+ return DAGTagCollectionResponse(tags=[dag_tag for dag_tag in dag_tags],
total_entries=total_entries)
+
Review Comment:
Hi @pierrejeambrun, I encountered an issue with `SortParm` when working on
PostgreSQL. The error details are as follows:
```
2024-10-17 16:30:52.868 UTC [15780] ERROR: for SELECT DISTINCT, ORDER BY
expressions must appear in select list at character 84
2024-10-17 16:30:52.868 UTC [15780] STATEMENT: SELECT DISTINCT dag_tag.name
FROM dag_tag
WHERE dag_tag.name ILIKE '%%' ORDER BY CASE WHEN (dag_tag.name IS
NOT NULL) THEN 0 ELSE 1 END, dag_tag.name ASC, dag_tag.name
LIMIT 2 OFFSET 1
```
I haven't yet thought of a solution that avoids distinguishing the dialect
type for returning a specific SQL statement.
--
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]