pierrejeambrun commented on code in PR #55160:
URL: https://github.com/apache/airflow/pull/55160#discussion_r2348359860
##########
airflow-core/src/airflow/models/log.py:
##########
@@ -56,6 +56,14 @@ class Log(Base):
primaryjoin="Log.dag_id == DagModel.dag_id",
)
+ task_instance = relationship(
+ "TaskInstance",
+ viewonly=True,
+ foreign_keys=[task_id],
+ primaryjoin="Log.task_id == TaskInstance.task_id",
+ lazy="selectin",
+ )
+
Review Comment:
We shouldn't add this to the model. Because this will impact and preload
`TI` for all requests on `Log`. Even if this is not necessary, for instance the
scheduler is querying this table, and it will start emitting additional queries
to load that relationship.
We should instead to that only on the `apiserver` part in the `get_logs`
endpoint basically. `.options(...)` to the Log query there.
This will help preventing unexpected side effects.
--
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]