pierrejeambrun commented on code in PR #35403:
URL: https://github.com/apache/airflow/pull/35403#discussion_r1408159725


##########
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:
   I am not suggesting that we use a query param list with braked notation, 
exploded would be something like:
   `?run_state=queued&run_state=success….`
   
   Then flask handles this nicely with getlist I believe, no need for manual 
parsing. Cf link above for more information
   
   



##########
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:
   I am not suggesting that we use a query param list with braked notation, 
exploded would be something like:
   `?run_state=queued&run_state=success….`
   
   Then flask handles this nicely with getlist I believe, no need for manual 
parsing. Cf link above for more information
   
   



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to