Fix Variable.set rewriting team_name of existing variables (#71810) - #71823
Fix Variable.set rewriting team_name of existing variables (#71810)#71823ccoliu wants to merge 2 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
vincbeck
left a comment
There was a problem hiding this comment.
Interesting, but doing this would then prevent to change the ownership of a variable through the public API? We might need to differentiate the public API vs execution API path?
ca3f712 to
29d37c6
Compare
Good catch! I checked the current implementation:
So the boundary is already there — the only path that silently overwrites |
Thanks! |
When
core.multi_team = True, callingVariable.set(key="k", value="v2", team_name="team_a")on an existing variable rewritesteam_nameto"team_a"in theON CONFLICT (key) DO UPDATEclause.This overwrites the original ownership of existing global variables (or variables belonging to other teams), causing subsequent global lookups (e.g.
Variable.get("k")withoutteam_name, as done during DAG parsing) to fail withKeyError.This PR removes
team_namefromupdate_fieldsinVariable.set(), preserving the originalteam_nameownership of existing variables during value updates.closes: #71810
Was generative AI tooling used to co-author this PR?
Generated-by: Claude following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.