uranusjr commented on code in PR #70972:
URL: https://github.com/apache/airflow/pull/70972#discussion_r3710518463


##########
airflow-core/src/airflow/models/asset.py:
##########
@@ -749,21 +749,28 @@ def __repr__(self):
 class AssetDagRunQueue(Base):
     """Model for storing asset events that need processing."""
 
-    asset_id: Mapped[int] = mapped_column(Integer, primary_key=True, 
nullable=False)
     target_dag_id: Mapped[str] = mapped_column(StringID(), primary_key=True, 
nullable=False)
+    asset_event_id: Mapped[int] = mapped_column(Integer, primary_key=True, 
nullable=False)
+    asset_id: Mapped[int] = mapped_column(Integer, nullable=False)
     created_at: Mapped[datetime] = mapped_column(UtcDateTime, 
default=timezone.utcnow, nullable=False)
     asset: Mapped[AssetModel] = relationship("AssetModel", viewonly=True)
     dag_model: Mapped[DagModel] = relationship("DagModel", viewonly=True)
 
     __tablename__ = "asset_dag_run_queue"
     __table_args__ = (
-        PrimaryKeyConstraint(asset_id, target_dag_id, 
name="assetdagrunqueue_pkey"),
+        PrimaryKeyConstraint(target_dag_id, asset_event_id, 
name="assetdagrunqueue_pkey"),
         ForeignKeyConstraint(
             (asset_id,),
             ["asset.id"],
             name="adrq_asset_fkey",
             ondelete="CASCADE",
         ),
+        ForeignKeyConstraint(
+            (asset_event_id,),
+            ["asset_event.id"],
+            name="adrq_asset_event_fkey",

Review Comment:
   I would say the new behavior is more correct since arguably it is 
unintuitive for a deleted asset event to still be able to contribute to a dag 
being triggered.
   
   I will also add a significant news fragment since this is a behavioral 
change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to