chenglongyan commented on issue #27077:
URL: https://github.com/apache/airflow/issues/27077#issuecomment-1280017217

   A string with an ```.sql``` suffix is considered a file rather than a jinjia 
template.
   
   
   ```python
   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"
       )
   ```
   ---
   Refer to the ```template_ext``` field  of 
[PostgresOperator](https://airflow.apache.org/docs/apache-airflow-providers-postgres/stable/_api/airflow/providers/postgres/operators/postgres/index.html#airflow.providers.postgres.operators.postgres.PostgresOperator.template_ext)
 and 
[templating-with-jinja](https://airflow.apache.org/docs/apache-airflow/stable/tutorial/fundamentals.html#templating-with-jinja)
   


-- 
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]

Reply via email to