kameshkotwani opened a new issue, #27077:
URL: https://github.com/apache/airflow/issues/27077
### Apache Airflow version
main (development)
### What happened
I am trying to pass a sql parameter as a Jinja Template, but not able to. I
am a bit new to Airflow, here is the code, I am not sure if the Jinja
templating works in PostgresOperator or not. If there is any other way we can
pass please let me know, again I am not trying to pass the jinja template
inside the SQL query or file, I am passing the name of the SQL file using the
Jinja template which it is not able to render.
### What you think should happen instead
The Jinja Template should be rendered at `sql` parameter in PostgresOperator.
### How to reproduce
```
write_to_postgres = PostgresOperator(
task_id ="write_to_postgres",
postgres_conn_id="mypostgres",
#TODO investigate, why this is not working
sql ="queries{{ execution_date.hour }}{{ execution_date.day }}.sql"
)
```
Output of rendered in PostgresOperator

However, the BashOperator is able to render it properly
```bash
delete_queries_file = BashOperator(
task_id ="delete_queries_file",
bash_command="cd /opt/airflow/dags && rm queries{{
execution_date.hour }}{{ execution_date.day }}.sql"
)
```
Output of the BashOperator with proper rendered of Jinja Template

### Operating System
Windows 10
### Versions of Apache Airflow Providers
apache-airflow-providers-common-sql==1.2.0
apache-airflow-providers-ftp==3.1.0
apache-airflow-providers-http==4.0.0
apache-airflow-providers-imap==3.0.0
apache-airflow-providers-postgres==5.2.2
apache-airflow-providers-sqlite==3.2.1
### Deployment
Docker-Compose
### Deployment details
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]