SamWheating commented on a change in pull request #18924:
URL: https://github.com/apache/airflow/pull/18924#discussion_r727556838
##########
File path: airflow/api_connexion/endpoints/dag_endpoint.py
##########
@@ -60,13 +60,16 @@ def get_dag_details(dag_id):
@security.requires_access([(permissions.ACTION_CAN_READ,
permissions.RESOURCE_DAG)])
@format_parameters({'limit': check_limit})
@provide_session
-def get_dags(limit, session, offset=0, only_active=True, tags=None):
+def get_dags(limit, session, offset=0, only_active=True, tags=None,
search=None):
"""Get all DAGs."""
if only_active:
dags_query = session.query(DagModel).filter(~DagModel.is_subdag,
DagModel.is_active)
else:
dags_query = session.query(DagModel).filter(~DagModel.is_subdag)
+ if search:
+ dags_query = dags_query.filter(DagModel.dag_id.ilike(f'%{search}%'))
Review comment:
Because the search string is passed directly into an `ilike` command,
underscore characters will be treated as single-character wildcards. This means
that `GET /dags?search=extract_table_` could return a DAG called
`extract_tables`.
Is it worth escaping underscores in the search string, or should that be
considered the intended behaviour?
--
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]