2022-09-17

How to support Airflow jinja template in sqlfluff

I want to run sqlfluff fix command to this sql file. This SQL is for Snowflake and will be executed in Airflow. ti.xcom_pull is a function used in Airflow DAG.

DELETE FROM test
WHERE date = '';    

then I got this error in fix command.

L:   1 | P:   1 |  TMP | Unrecoverable failure in Jinja templating: 'ti' is
                       | undefined. Have you configured your variables?
                       | https://docs.sqlfluff.com/en/latest/configuration.html

This means that sqlfluff does not directly support Airflow template and we have to provide variable for ti.xcom_pull. How can I do it?



No comments:

Post a Comment