pierrejeambrun commented on code in PR #62910:
URL: https://github.com/apache/airflow/pull/62910#discussion_r2925337563


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py:
##########
@@ -481,7 +482,14 @@ def get_task_instances(
     """
     dag_run = None
     query = (
-        
select(TI).join(TI.dag_run).outerjoin(TI.dag_version).options(*eager_load_TI_and_TIH_for_validation())
+        select(TI)
+        .join(TI.dag_run)
+        .outerjoin(TI.dag_version)
+        .options(
+            contains_eager(TI.dag_run).joinedload(DagRun.dag_model),
+            contains_eager(TI.dag_version).joinedload(DagVersion.bundle),
+            joinedload(TI.task_instance_note),
+        )

Review Comment:
   This is not the only place that appears to need fixing. Can you fix other 
places too in the same file.
   
   Also I would be for keeping `eager_load_TI_and_TIH_for_validation` and 
removing the join at the beginning of the query. So we have the shared code in 
the same function.



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