-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Description
Description
PR #37028 in Airflow 2.10.0 introduced the ability to pass a Python callable to templateable fields, instead of a Jinja templated string:
https://www.astronomer.io/docs/learn/templating/#use-a-python-callable-for-template-fields
In Airflow 2.10+ it is possible to pass a Python callable to templateable fields. This is especially useful when the parameter value is created using complex operations that might not be possible or are hard to read in Jinja.
However, this feature doesn't seem to work for @task.* decorated tasks.
IMO it doesn't make sense to introduce a new feature that only works with the old style of tasks.
This feature is to make the new Python callable templating work for @task decorated TaskFlow API tasks.
Use case/motivation
I want to specify a Python function for a templated field, instead of a Jinja templated string, for the reasons mentioned in the linked PR. For complex logic, it's much easier to implement and read Jinja rendering functions than a Jinja templated string.
Related issues
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct