Jinja templating in decorated task - loading external files #39380
-
Version: 2.7.3 I have a python function with the task.short_circuit decorator. This task uses several Boolean parameters and an SQL query to check if downstream tasks should be skipped @task.short_circuit(task_id='check_run_conditions')
def check_task(bool_1, bool_2, bool_3, sql_query = "path/to/query.sql"):
... In normal airflow operators I have been able to use the check_db = CustomSQLTaskOperator(
task_id="check_task",
...
sql="/path/to/query.sql"
) However, I have not found a way to make a decorated task do the same. Is there a way to have jinja load content from a file in a python decorated task? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Forgot to mention- while I can just include the SQL query as a string in python itself, it is preferred to leave it out due to its length and general project desires. |
Beta Was this translation helpful? Give feedback.
https://airflow.apache.org/docs/apache-airflow/stable/howto/operator/python.html#templating