aaron-y-chen commented on code in PR #76493:
URL: https://github.com/apache/airflow/pull/76493#discussion_r4743113760
##########
airflow-core/src/airflow/models/dag.py:
##########
@@ -896,17 +910,28 @@ def calculate_dagrun_date_fields(
)
@staticmethod
- @cached(_team_name_cache, key=lambda dag_id, **_: dag_id,
lock=_team_name_cache_lock)
- @provide_session
- def get_team_name(dag_id: str, *, session: Session = NEW_SESSION) -> str |
None:
- """Return the team name associated to a Dag or None if it is not owned
by a specific team."""
- stmt = (
+ def _build_team_name_query(dag_id: str) -> Select[tuple[str]]:
+ return (
select(Team.name)
.join(DagBundleModel.teams)
.join(DagModel, DagModel.bundle_name == DagBundleModel.name)
.where(DagModel.dag_id == dag_id)
)
- return session.scalar(stmt)
+
+ @staticmethod
+ def get_team_name(dag_id: str, *, session: Session | None = None) -> str |
None:
Review Comment:
Sure, let me take care of it
##########
airflow-core/src/airflow/models/dag.py:
##########
@@ -896,17 +910,28 @@ def calculate_dagrun_date_fields(
)
@staticmethod
- @cached(_team_name_cache, key=lambda dag_id, **_: dag_id,
lock=_team_name_cache_lock)
- @provide_session
- def get_team_name(dag_id: str, *, session: Session = NEW_SESSION) -> str |
None:
- """Return the team name associated to a Dag or None if it is not owned
by a specific team."""
- stmt = (
+ def _build_team_name_query(dag_id: str) -> Select[tuple[str]]:
+ return (
select(Team.name)
.join(DagBundleModel.teams)
.join(DagModel, DagModel.bundle_name == DagBundleModel.name)
.where(DagModel.dag_id == dag_id)
)
- return session.scalar(stmt)
+
+ @staticmethod
+ def get_team_name(dag_id: str, *, session: Session | None = None) -> str |
None:
Review Comment:
done
--
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]