Skip to content

Commit

Permalink
Order XCom entries by map index in API (#37086)
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Jan 31, 2024
1 parent 0c4210a commit ed0c967
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airflow/api_connexion/endpoints/xcom_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def get_xcom_entries(
query = query.where(XCom.map_index == map_index)
if xcom_key is not None:
query = query.where(XCom.key == xcom_key)
query = query.order_by(DR.execution_date, XCom.task_id, XCom.dag_id, XCom.key)
# Match idx_xcom_task_instance + idx_xcom_key for performance.
query = query.order_by(XCom.dag_id, XCom.task_id, XCom.run_id, XCom.map_index, XCom.key)
total_entries = get_query_count(query, session=session)
query = session.scalars(query.offset(offset).limit(limit))
return xcom_collection_schema.dump(XComCollection(xcom_entries=query, total_entries=total_entries))
Expand Down

0 comments on commit ed0c967

Please sign in to comment.