pierrejeambrun commented on issue #46730:
URL: https://github.com/apache/airflow/issues/46730#issuecomment-2659458189

   The goal for this is to put the alongside certain fields other related 
fields that are useful for the UI.
   
   To achieve that you can leverage `AliasPath`. For instance on 
`TaskInstanceResponse`, to add the related `dag_display_name` we can simply add:
   ```
   dag_display_name: str = Field(validation_alias=AliasPath("dag_run", 
"dag_model", "dag_display_name"))
   ```
   
   As mentioned in the issue we should to that for different aliases. Careful 
because such AliasPath will access relationship. To evoid emitting 1 extra lazy 
query at access time (that would be problematic for `list` endpoint) you can 
eagerload those relationships. (`.options(joinedload(...))`)


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