This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 6e411d8baee Clarify AssetPartitionDagRun provisional-run docstring
(#69982)
6e411d8baee is described below
commit 6e411d8baee40444310ee9ca27fa31847f6e5902
Author: Daniel Standish <[email protected]>
AuthorDate: Sun Jul 19 14:27:19 2026 -0700
Clarify AssetPartitionDagRun provisional-run docstring (#69982)
The previous wording ("we should not allow more than one like this") did not
state the actual invariant. Make explicit that rows are never deleted — so
multiple records per target_dag_id/partition_key are expected — and that the
constraint is specifically at most one row with a null created_dag_run_id,
which the _lock_asset_model mutex enforces.
---
airflow-core/src/airflow/models/asset.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/airflow-core/src/airflow/models/asset.py
b/airflow-core/src/airflow/models/asset.py
index 4354034e649..0788611d8a0 100644
--- a/airflow-core/src/airflow/models/asset.py
+++ b/airflow-core/src/airflow/models/asset.py
@@ -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)