Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions airflow-core/src/airflow/models/serialized_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,15 @@ def write_dag(

@classmethod
def latest_item_select_object(cls, dag_id):
from airflow.settings import engine

if engine.dialect.name == "mysql":
# Prevent "Out of sort memory" caused by large values in cls.data column for MySQL.
# Details in https://github.com/apache/airflow/pull/55589
latest_item_id = (
select(cls.id).where(cls.dag_id == dag_id).order_by(cls.created_at.desc()).limit(1)
)
return select(cls).where(cls.id == latest_item_id)
return select(cls).where(cls.dag_id == dag_id).order_by(cls.created_at.desc()).limit(1)

@classmethod
Expand Down