Skip to content

SnowflakeCheckOperator - The conn_id None isn't defined #29198

@leoneuwald

Description

@leoneuwald

Apache Airflow Provider(s)

snowflake

Versions of Apache Airflow Providers

apache-airflow-providers-snowflake==4.0.2

Apache Airflow version

2.5.1

Operating System

Debian GNU/Linux 11 (bullseye)

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

What happened

After upgrading the apache-airflow-providers-snowflake from version 3.3.0 to 4.0.2, the SnowflakeCheckOperator tasks starts to throw the following error:

  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/common/sql/operators/sql.py", line 179, in get_db_hook
    return self._hook
  File "/usr/local/lib/python3.9/functools.py", line 993, in __get__
    val = self.func(instance)
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/common/sql/operators/sql.py", line 141, in _hook
    conn = BaseHook.get_connection(self.conn_id)
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/hooks/base.py", line 72, in get_connection
    conn = Connection.get_connection_from_secrets(conn_id)
  File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/connection.py", line 435, in get_connection_from_secrets
    raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined")
airflow.exceptions.AirflowNotFoundException: The conn_id `None` isn't defined

What you think should happen instead

No response

How to reproduce

  • Define a Snowflake Connection with the name snowflake_default
  • Create a Task similar to this:
  my_task = SnowflakeCheckOperator(
      task_id='my_task',
      warehouse='warehouse',
      database='database',
      schema='schema',
      role='role',
      sql='select 1 from my_table'
  )
  • Run and check the error.

Anything else

We can workaround this by adding the conn_id='snowflake_default' to the SnowflakeCheckOperator.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions