pierrejeambrun commented on code in PR #35403:
URL: https://github.com/apache/airflow/pull/35403#discussion_r1405480918
##########
airflow/www/views.py:
##########
@@ -3527,13 +3527,15 @@ def grid_data(self):
with create_session() as session:
query = select(DagRun).where(DagRun.dag_id == dag.dag_id,
DagRun.execution_date <= base_date)
- run_type = request.args.get("run_type")
- if run_type:
- query = query.where(DagRun.run_type == run_type)
-
- run_state = request.args.get("run_state")
- if run_state:
- query = query.where(DagRun.state == run_state)
+ run_type_raw = request.args.get("run_type")
+ if run_type_raw:
+ run_types = {run_type.strip() for run_type in
run_type_raw.split(",")}
+ query = query.where(DagRun.run_type.in_(run_types))
+
+ run_state_raw = request.args.get("run_state")
+ if run_state_raw:
+ run_states = {run_state.strip() for run_state in
run_state_raw.split(",")}
+ query = query.where(DagRun.state.in_(run_states))
Review Comment:
To avoid passing these as a big string and parsing this manually in the
backend, you can use `request.args.getlist` and pass the query param list in a
exploded way. cf query parameters section
https://swagger.io/docs/specification/serialization/.
There is no OpenAPI 'standard' for passing list in a query param, and I
don't think we have define how to handle this in the webserver yet.
This would just avoid some boilerplate code.
--
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]