Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions airflow-core/docs/core-concepts/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
5 changes: 5 additions & 0 deletions airflow-core/docs/core-concepts/params.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down