Skip to content

Make host/port configurable for Snowflake connections - #44079

Merged
potiuk merged 1 commit into
apache:mainfrom
whummer:airflow-local
Nov 16, 2024
Merged

Make host/port configurable for Snowflake connections#44079
potiuk merged 1 commit into
apache:mainfrom
whummer:airflow-local

Conversation

@whummer

@whummer whummer commented Nov 15, 2024

Copy link
Copy Markdown
Contributor

First of all - thanks so much for building Airflow, it is an absolutely awesome platform! 🙌 🚀

This PR extends the functionality of SnowflakeHook to make the host/port configurable for Snowflake connections. This facilitates testing against non-standard Snowflake endpoints, for example when testing against LocalStack (a local cloud emulator).

A similar PR has been created against the Astronomer Cosmos repo some time ago (see astronomer/astronomer-cosmos#1063), and our users have now requested to use the standard Airflow Snowflake connector with LocalStack Snowflake as well.

The PR also updates the documentation for the Snowflake connector, but it does not contain any tests at this point. If adding a test is required, then any pointers or guidance would be appreciated. 👍

Testing

Tested this locally against the LocalStack Snowflake emulator - with a connection config like this:

image

... and a simple DAG like this:

from airflow import DAG
from airflow.providers.snowflake.operators.snowflake import SnowflakeOperator

conn_id = "snowflake_local"

dag = DAG(
    'snowflake_test',
    default_args={'snowflake_conn_id': conn_id},
    tags=['example'],
    catchup=False,
)

snowflake_op_sql_str = SnowflakeOperator(
    task_id='query1',
    dag=dag,
    sql="SELECT CURRENT_ACCOUNT()",
)

... the DAG executes successfully, and outputs:
image


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg Bot added area:providers kind:documentation provider:snowflake Issues related to Snowflake provider labels Nov 15, 2024
@whummer
whummer marked this pull request as ready for review November 15, 2024 23:23

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that kind of change tests are not needed (other than testing when we release it)

@potiuk
potiuk merged commit d8bff00 into apache:main Nov 16, 2024
@whummer
whummer deleted the airflow-local branch November 16, 2024 01:28
kandharvishnu pushed a commit to kandharvishnu/airflow that referenced this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants