This is an automated email from the ASF dual-hosted git repository.
vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 132ec4f59b8 Fix Variable.set rewriting team_name of existing variables
(#71823)
132ec4f59b8 is described below
commit 132ec4f59b8bc3b3795113ac6e5fc3d0f8d697a2
Author: ccoliu <[email protected]>
AuthorDate: Thu Aug 20 23:08:55 2026 +0800
Fix Variable.set rewriting team_name of existing variables (#71823)
---
airflow-core/src/airflow/models/variable.py | 1 -
airflow-core/tests/unit/models/test_variable.py | 8 ++++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/models/variable.py
b/airflow-core/src/airflow/models/variable.py
index c366a2482b1..9493cab60aa 100644
--- a/airflow-core/src/airflow/models/variable.py
+++ b/airflow-core/src/airflow/models/variable.py
@@ -287,7 +287,6 @@ class Variable(Base, LoggingMixin):
val=val,
description=description,
is_encrypted=is_encrypted,
- team_name=team_name,
)
stmt = build_upsert_stmt(
get_dialect_name(session), Variable, ["key"], upsert_values,
update_fields
diff --git a/airflow-core/tests/unit/models/test_variable.py
b/airflow-core/tests/unit/models/test_variable.py
index 001a29a7c0c..0bc32373a30 100644
--- a/airflow-core/tests/unit/models/test_variable.py
+++ b/airflow-core/tests/unit/models/test_variable.py
@@ -369,6 +369,14 @@ class TestVariable:
finally:
session.rollback()
+ @conf_vars({("core", "multi_team"): "True"})
+ def test_variable_set_does_not_change_team_name_on_update(self,
testing_team, session):
+ Variable.set(key="k", value="v1", session=session)
+
+ Variable.set(key="k", value="v2", team_name=testing_team.name,
session=session)
+
+ assert Variable.get("k") == "v2"
+
@mock.patch("airflow.models.variable.ensure_secrets_loaded")
def test_caching_caches(self, mock_ensure_secrets: mock.Mock):
mock_backend = mock.Mock()