pierrejeambrun commented on PR #70312:
URL: https://github.com/apache/airflow/pull/70312#issuecomment-5132731226

   Actually something like:
    Yeah — the mixin's two ugly parts (the sa_inspect().unloaded walk and the 
generic string _team_path) both disappear if you (1) localize the 
teams[0]→scalar on the bundle and (2) let association_proxy do
     the chaining. Here's the shape I'd go for, no migration needed:
   ```
     # DagBundleModel — collapse the M-N collection to a scalar in ONE place
     @property
     def team_name(self) -> str | None:
         # unique index on dag_bundle_team.dag_bundle_name → at most one team
         return self.teams[0].name if self.teams else None
   
     # DagModel — the only place with real logic: the multi_team gate
     @property
     def team_name(self) -> str | None:
         if not conf.getboolean("core", "multi_team"):
             return None
         return self.bundle.team_name if self.bundle else None   # bundle 
lazy="raise" IS the guard
   
     # DagRun / TaskInstance — just chain, no logic
     team_name = association_proxy("dag_model", "team_name")
     team_name = association_proxy("dag_run", "team_name")
   ```


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