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


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -141,6 +141,7 @@ def get_dag_run(dag_id: str, dag_run_id: str, session: 
SessionDep) -> DAGRunResp
             status.HTTP_404_NOT_FOUND,
             f"The DagRun with dag_id: `{dag_id}` and run_id: `{dag_run_id}` 
was not found",
         )
+    attach_team_names([dag_run], session=session)

Review Comment:
   That pattern seems like a maintainability burden and that goes against how 
we do things for other related attribute.
   
   Everywhere you need `team_name`, you need to manually call this 
`attach_team_names` function beforehand, or you will get wrong `None` value for 
team.
   
   Instead can we move this at the relationship level on models or via a proxy, 
so `entity.team_name` always return the correct value. I think there's a cached 
per dag resolver  or something `DagModel.get_team_name`. 
   
   Also if eager loading the realtionship that could remove the extra query all 
together.



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