o-nikolas commented on code in PR #58905:
URL: https://github.com/apache/airflow/pull/58905#discussion_r2587045599


##########
airflow-core/src/airflow/secrets/environment_variables.py:
##########
@@ -33,11 +33,16 @@ class EnvironmentVariablesBackend(BaseSecretsBackend):
     def get_conn_value(self, conn_id: str) -> str | None:
         return os.environ.get(CONN_ENV_PREFIX + conn_id.upper())
 
-    def get_variable(self, key: str) -> str | None:
+    def get_variable(self, key: str, team_id: str | None = None) -> str | None:
         """
         Get Airflow Variable from Environment Variable.
 
         :param key: Variable Key
+        :param team_id: ID of the team associated to the task trying to access 
the variable (if any)
         :return: Variable Value
         """
+        if team_id and (team_var := 
os.environ.get(f"{VAR_ENV_PREFIX}_{team_id.upper()}__" + key.upper())):
+            # Format to set a team specific variable: 
AIRFLOW_VAR__<TEAM_ID>__<VAR_KEY>

Review Comment:
   > The alternative is to drop the team_id PK and make the team name PK. 
That's what dag bundle is doing for instance. Any preference?
   
   We had spoken in the past about allowing multiple teams to have the same 
name, but perhaps that's a bit too strict for something that's just 
"multi-team" and not "multi-tenant". So I suppose I'm okay with either approach.



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