jroachgolf84 commented on code in PR #49994:
URL: https://github.com/apache/airflow/pull/49994#discussion_r2068621502


##########
airflow-core/src/airflow/models/asset.py:
##########
@@ -276,6 +276,19 @@ class AssetModel(Base):
     producing_tasks = relationship("TaskOutletAssetReference", 
back_populates="asset")
     triggers = relationship("Trigger", 
secondary=asset_trigger_association_table, back_populates="assets")
 
+    # ForeignKey("asset_event.id") -> this was originally in the 
last_asset_event_id definition
+    # The default value should be None. When an Asset is defined, it is not 
yet tied to an AssetEvent
+    last_asset_event_id = Column(Integer, default=None)
+    last_asset_event_timestamp = Column(UtcDateTime, default=None)
+
+    last_event = relationship(
+        "AssetEvent",
+        primaryjoin="AssetModel.last_asset_event_id == foreign(AssetEvent.id)",
+        viewonly=True,
+        lazy="select",
+        uselist=False,
+    )

Review Comment:
   Would the changes then need to be made here?
   
   
https://github.com/apache/airflow/blob/11772dbb45e2f2893dcf73a11d9790f192360168/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py#L124
   
   
https://github.com/apache/airflow/blob/11772dbb45e2f2893dcf73a11d9790f192360168/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py#L383



-- 
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