diff --git a/airflow-core/docs/core-concepts/operators.rst b/airflow-core/docs/core-concepts/operators.rst index ac460183c2f7a..6bcf4a3c7140a 100644 --- a/airflow-core/docs/core-concepts/operators.rst +++ b/airflow-core/docs/core-concepts/operators.rst @@ -303,6 +303,13 @@ Alternatively, Jinja can also be instructed to render a native Python object. Th python_callable=transform, ) +.. note:: + + ``NativeEnvironment`` renders values according to Python literal rules. This is useful when a template + should produce a list, dict, number, or boolean, but it also means a string that looks like a number, + such as ``"42"``, can be rendered as the integer ``42``. Keep the default string rendering, use a + callable template field, or add explicit quoting if the task needs the value to stay a string. + .. _concepts:reserved-keywords: diff --git a/airflow-core/docs/core-concepts/params.rst b/airflow-core/docs/core-concepts/params.rst index ac5df462fac98..2f70611e88c29 100644 --- a/airflow-core/docs/core-concepts/params.rst +++ b/airflow-core/docs/core-concepts/params.rst @@ -145,6 +145,11 @@ This way, the :class:`~airflow.sdk.definitions.param.Param`'s type is respected ), ) +Because ``render_template_as_native_obj=True`` uses Jinja's native rendering, values that look like +Python literals can also be converted. For example, a string value of ``"42"`` may be rendered as the +integer ``42``. Leave native rendering disabled, use a callable template field, or quote the value +explicitly when the task must receive a string. + Another way to access your param is via a task's ``context`` kwarg. .. code-block::