joeknize-bc opened a new issue, #33679:
URL: https://github.com/apache/airflow/issues/33679

   ### Apache Airflow version
   
   2.7.0
   
   ### What happened
   
   When upgrading to apache-airflow-providers-snowflake==4.4.2, our 
SnowflakeCheckOperators are all failing with similar messages. The affected 
code seems to be from [this PR](https://github.com/apache/airflow/pull/30784).
   Code:
   ```
       check_order_load = SnowflakeCheckOperator(
           task_id="check_row_count",
           sql='check_orders_load.sql',
           snowflake_conn_id=SF_CONNECTION_ID,
       )
   ```
   
   Errors:
   ```
   [2023-08-23, 20:58:23 UTC] {taskinstance.py:1943} ERROR - Task failed with 
exception
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.11/site-packages/airflow/models/abstractoperator.py", 
line 664, in _do_render_template_fields
       value = getattr(parent, attr_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
   AttributeError: 'SnowflakeCheckOperator' object has no attribute 
'snowflake_conn_id'
   During handling of the above exception, another exception occurred:
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.11/site-packages/airflow/models/taskinstance.py", line 
1518, in _run_raw_task
       self._execute_task_with_callbacks(context, test_mode, session=session)
     File 
"/usr/local/lib/python3.11/site-packages/airflow/models/taskinstance.py", line 
1646, in _execute_task_with_callbacks
       task_orig = self.render_templates(context=context)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.11/site-packages/airflow/models/taskinstance.py", line 
2291, in render_templates
       original_task.render_template_fields(context)
     File 
"/usr/local/lib/python3.11/site-packages/airflow/models/baseoperator.py", line 
1244, in render_template_fields
       self._do_render_template_fields(self, self.template_fields, context, 
jinja_env, set())
     File "/usr/local/lib/python3.11/site-packages/airflow/utils/session.py", 
line 77, in wrapper
       return func(*args, session=session, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.11/site-packages/airflow/models/abstractoperator.py", 
line 666, in _do_render_template_fields
       raise AttributeError(
   AttributeError: 'snowflake_conn_id' is configured as a template field but 
SnowflakeCheckOperator does not have this attribute.```
   
   
   ### What you think should happen instead
   
   This works fine in apache-airflow-providers-snowflake==4.4.1 - no errors.
   
   ### How to reproduce
   
   With `apache-airflow-providers-snowflake==4.4.2`
   
   
   Try running this code:
   
   ```
   from airflow.providers.snowflake.operators.snowflake import 
SnowflakeCheckOperator
   
       check_task = SnowflakeCheckOperator(
           task_id='check_gmv_yoy',
           sql='select 1',
           snowflake_conn_id='NAME_OF_CONNECTION_ID',
       )
   ```
   
   ### Operating System
   
   Debian GNU/Linux 11 (bullseye)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-snowflake==4.4.2
   
   
   ### Deployment
   
   Astronomer
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   This happens every time with 4.4.2, never with <= 4.4.1.
   
   ### 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: commits-unsubscr...@airflow.apache.org.apache.org

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

Reply via email to