Skip to content
Open
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
12 changes: 9 additions & 3 deletions airflow-core/src/airflow/models/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,15 @@ class AssetPartitionDagRun(Base):
We can look up the AssetEvents that contribute to AssetPartitionDagRun entities
with the PartitionedAssetKeyLog mapping table.

Where dag_run_id is null, the dag run has not yet been created.
We should not allow more than one like this. But to guard against
an accident, we should always work on the latest one.
Rows are never deleted from this table, so multiple records with the same
target_dag_id / partition_key are expected in general; each dag run that
gets created leaves its APDR record behind.

Where created_dag_run_id is null, the dag run has not yet been created.
We should not allow more than one row with the same target_dag_id /
partition_key where created_dag_run_id is null, and this is what the
`_lock_asset_model` mutex control is for. In case a duplicate somehow
gets created, we always work on the latest matching APDR record.
"""

id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
Expand Down