You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/09/23 10:01:24 UTC

[GitHub] [airflow] ashb commented on a diff in pull request #26626: Use COALESCE when ordering runs to handle NULL

ashb commented on code in PR #26626:
URL: https://github.com/apache/airflow/pull/26626#discussion_r978471417


##########
airflow/www/views.py:
##########
@@ -3456,10 +3456,7 @@ def grid_data(self):
             if run_state:
                 query = query.filter(DagRun.state == run_state)
 
-            ordering = (DagRun.__table__.columns[name].desc() for name in dag.timetable.run_ordering)
-            dag_runs = query.order_by(*ordering, DagRun.id.desc()).limit(num_runs).all()
-            dag_runs.reverse()
-
+            dag_runs = wwwutils.sorted_dag_runs(query, ordering=dag.timetable.run_ordering, limit=num_runs)

Review Comment:
   This feels more like it should be a method on DagRun class maybe? (That way this can be used by API or CLI too)



-- 
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-unsubscribe@airflow.apache.org

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