You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/18 11:29:10 UTC

[GitHub] [airflow] ToxaZ opened a new issue #9373: path to file as sql parameter in PostgresOperator not working anymore

ToxaZ opened a new issue #9373:
URL: https://github.com/apache/airflow/issues/9373


   **Apache Airflow version**: 1.10.10
   
   **What happened**:
   
   ```python
   maintenance_operator = PostgresOperator(
           task_id='get_tables_size',
           postgres_conn_id='pentaho',
           sql='./dags/maintenance/queries/get_tables_size.sql')
   ```
   brings an error
   `jinja2.exceptions.TemplateNotFound: ./dags/maintenance/queries/get_tables_size.sql`
   
   **What you expected to happen**:
   
   PostgresOperator not parsing path to file. Instead tries to evaluate path string as sql query string.
   The only way to make it work now:
   
   ```python
   maintenance_operator = PostgresOperator(
           task_id='get_tables_size',
           postgres_conn_id='pentaho',
           sql=open(
               './dags/pentaho_maintenance/queries/get_tables_size.sql')
               .read())
   ```
   
   **Anything else we need to know**:
   
   Properly worked on airflow 1.10.2


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #9373:
URL: https://github.com/apache/airflow/issues/9373#issuecomment-647025444


   can you try with the following:
   
   ```
   maintenance_operator = PostgresOperator(
           task_id='get_tables_size',
           postgres_conn_id='pentaho',
           sql='maintenance/queries/get_tables_size.sql')
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #9373:
URL: https://github.com/apache/airflow/issues/9373#issuecomment-865426239


   This issue has been automatically marked as stale because it has been open for 30 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
eladkal commented on issue #9373:
URL: https://github.com/apache/airflow/issues/9373#issuecomment-786202782


   I'm unable to reproduce.
   
   ```
   with DAG(
       dag_id="testing_postgres",
       default_args=default_args,
       schedule_interval=None
   ) as dag:
   
       t3 = PostgresOperator(
           task_id='get_tables_size',
           postgres_conn_id='postgres_new',
           sql='maintenance/queries/my.sql'
       )
   ```
   
   ![Screen Shot 2021-02-25 at 23 05 05](https://user-images.githubusercontent.com/45845474/109216999-ecc83480-77bd-11eb-84a4-0a0cc6fe5413.png)
   
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ToxaZ commented on issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
ToxaZ commented on issue #9373:
URL: https://github.com/apache/airflow/issues/9373#issuecomment-790112337


   @eladkal which version you have tested? I'm still getting an error on 1.10.10, 1.10.12, 1.10.14


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ToxaZ commented on issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
ToxaZ commented on issue #9373:
URL: https://github.com/apache/airflow/issues/9373#issuecomment-648474383


   Tried, doesn't work.
   Even absolute path gives an error:
   
   ```jinja2.exceptions.TemplateNotFound: /home/toxaz/work//pentaho_maintenance/queries/get_tables_size.sql```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
eladkal commented on issue #9373:
URL: https://github.com/apache/airflow/issues/9373#issuecomment-790723080


   1.10.14
   
   Where is your dag file located?
   Could it be that the sql file path isn't relative to the dag file? (if so did you define `template_searchpath` ?)
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ToxaZ closed issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
ToxaZ closed issue #9373:
URL: https://github.com/apache/airflow/issues/9373


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on issue #9373: path to file as sql parameter in PostgresOperator not working anymore

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #9373:
URL: https://github.com/apache/airflow/issues/9373#issuecomment-865426239


   This issue has been automatically marked as stale because it has been open for 30 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org