raphaelauv commented on PR #35844:
URL: https://github.com/apache/airflow/pull/35844#issuecomment-1826019503
the limitation with the current implementation is that the full templated
query is not available in airflow UI or logs
->
```python
import os
from airflow import DAG
from airflow.providers.common.sql.operators.sql import
SQLExecuteQueryOperator
from pendulum import today
from utils_dags import UTILS_SQL_PATH_RELATIVE
with DAG(
dag_id="test_sql_templating",
schedule_interval="0 0 * * *",
start_date=today("UTC").add(days=-1),
template_searchpath=[UTILS_SQL_PATH_RELATIVE],
):
SQLExecuteQueryOperator(
task_id="toto",
conn_id="airflow_db",
sql=os.path.join("toto.sql"),
parameters={"tutu": "{{ ds }}"}
)
```
where `toto.sql` file contain
```sql
select * from job where dag_id != %(tutu)s
```

also if I want use a function to apply a logic on the toto.sql file ( by
exemple wrap the query to create a redshift unload query it's impossible )
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]