This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-3-test by this push:
new 3efaef322e1 [v3-3-test] Clarify AssetPartitionDagRun provisional-run
docstring (#69982) (#70104)
3efaef322e1 is described below
commit 3efaef322e1666da801b89035c9cd898fc39801c
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Jul 20 00:00:18 2026 +0200
[v3-3-test] Clarify AssetPartitionDagRun provisional-run docstring (#69982)
(#70104)
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.
(cherry picked from commit 6e411d8baee40444310ee9ca27fa31847f6e5902)
Co-authored-by: Daniel Standish
<[email protected]>
---
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 60256f9cd88..5a48cbd4dac 100644
--- a/airflow-core/src/airflow/models/asset.py
+++ b/airflow-core/src/airflow/models/asset.py
@@ -912,9 +912,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)