This is an automated email from the ASF dual-hosted git repository. ephraimanierobi pushed a commit to branch v3-1-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 35a1bd03c6dbb7ce3f05774e06398af777b06917 Author: Shahar Epstein <[email protected]> AuthorDate: Sat Jan 31 11:35:37 2026 +0200 [v3-1-test] Clarify template context for asset-triggered DAGs in airflow-core docs (#61258) (#61282) (cherry picked from commit f7aa502b724ee27cf1609c84d9d6dc8f6d9c2f68) Co-authored-by: Rachana Dutta <[email protected]> Co-authored-by: kevinhongzl <[email protected]> --- airflow-core/docs/templates-ref.rst | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/airflow-core/docs/templates-ref.rst b/airflow-core/docs/templates-ref.rst index 0cbd8bf29c8..a8ba03528d1 100644 --- a/airflow-core/docs/templates-ref.rst +++ b/airflow-core/docs/templates-ref.rst @@ -21,6 +21,21 @@ Templates reference =================== Variables, macros and filters can be used in templates (see the :ref:`concepts:jinja-templating` section) +Asset-triggered DAGs +-------------------- + +Asset-triggered Dags in Apache Airflow 3 differ from time-based Dags in the +template context they provide. + +Asset-triggered Dags do not have a logical date, and therefore do not provide +time-based context variables such as ``logical_date``, ``ds``, ``ds_nodash``, +or values derived from them. + +For asset-triggered Dags, information related to the triggering run can be +accessed via ``dag_run``. For example, ``dag_run.run_id`` can be used to +uniquely identify a Dag run triggered by an asset event. + +.. versionadded:: 3.0.0 The following come for free out of the box with Airflow. Additional custom macros can be added globally through :doc:`administration-and-deployment/plugins`, or at a Dag level through the @@ -70,8 +85,13 @@ Variable Type Description ``{{ var.value }}`` Airflow variables. See `Airflow Variables in Templates`_ below. ``{{ var.json }}`` Airflow variables. See `Airflow Variables in Templates`_ below. ``{{ conn }}`` Airflow connections. See `Airflow Connections in Templates`_ below. -``{{ task_instance_key_str }}`` str | A unique, human-readable key to the task instance. The format is +``{{ task_instance_key_str }}`` str | A human-readable key to the task instance. + | + | For time-based DAGs, the format is | ``{dag_id}__{task_id}__{ds_nodash}``. + | + | For asset-triggered DAGs, the format uses the DAG run identifier instead: + | ``{dag_id}__{task_id}__{dag_run.run_id}``. ``{{ run_id }}`` str The currently running :class:`~airflow.models.dagrun.DagRun` run ID. ``{{ dag_run }}`` DagRun The currently running :class:`~airflow.models.dagrun.DagRun`. ``{{ test_mode }}`` bool Whether the task instance was run by the ``airflow test`` CLI.
