This is an automated email from the ASF dual-hosted git repository.
onikolas 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 999d71e8270 Update Variables docs - bug fix and multi-team (#62439)
999d71e8270 is described below
commit 999d71e8270abec3d4ef318ff26b45b28f6f5abc
Author: Niko Oliveira <[email protected]>
AuthorDate: Thu Feb 26 10:10:17 2026 -0800
Update Variables docs - bug fix and multi-team (#62439)
* Update Variables docs - bug fix and multi-team
- The docs incorrectly displayed how to access variables using a task sdk
context
- Also update the docs to more accurately describe the scoping of
variables as it relates to multi-team
These findings came as a result of UAT testing.
refs #62249
---
airflow-core/docs/core-concepts/multi-team.rst | 2 ++
airflow-core/docs/core-concepts/variables.rst | 9 +++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/airflow-core/docs/core-concepts/multi-team.rst
b/airflow-core/docs/core-concepts/multi-team.rst
index a1bd8a1dbcd..f7b84dcbc41 100644
--- a/airflow-core/docs/core-concepts/multi-team.rst
+++ b/airflow-core/docs/core-concepts/multi-team.rst
@@ -154,6 +154,8 @@ Or to skip the confirmation prompt:
Configuring Team Resources
--------------------------
+.. _multi-team-variables:
+
Team-scoped Variables
^^^^^^^^^^^^^^^^^^^^^
diff --git a/airflow-core/docs/core-concepts/variables.rst
b/airflow-core/docs/core-concepts/variables.rst
index 33b20aaac5a..d9590598303 100644
--- a/airflow-core/docs/core-concepts/variables.rst
+++ b/airflow-core/docs/core-concepts/variables.rst
@@ -44,9 +44,14 @@ You can also access variables through the Task Context using
def my_task():
context = get_current_context()
var = context["var"]
- my_variable = var.get("my_variable_name")
+ my_variable = var["value"].get("my_variable_name")
return my_variable
+The ``context["var"]`` dictionary provides two ways to access variables:
+
+- ``var["value"]``: returns the variable as a raw string value.
+- ``var["json"]``: returns the variable as a JSON value. This is useful when
the variable stores a dictionary, list, or other structured data.
+
You can also use them from :ref:`templates <concepts:jinja-templating>`::
# Raw value
@@ -55,7 +60,7 @@ You can also use them from :ref:`templates
<concepts:jinja-templating>`::
# Auto-deserialize JSON value
echo {{ var.json.<variable_name> }}
-Variables are **global**, and should only be used for overall configuration
that covers the entire installation; to pass data from one Task/Operator to
another, you should use :doc:`xcoms` instead.
+Variables are **global** unless created for a specific :ref:`Airflow Team
<multi-team-variables>` (if your environment is configured to use Multi-Team).
Global Variables should only be used for overall configuration that covers the
entire installation. Team based Variables should be used for overall
configuration related to one specific Team. To pass data from one Task/Operator
to another, you should use :doc:`xcoms` instead.
We also recommend that you try to keep most of your settings and configuration
in your Dag files, so it can be versioned using source control; Variables are
really only for values that are truly runtime-dependent.