Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make host/port configurable for Snowflake connections #44079

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

whummer
Copy link
Contributor

@whummer whummer commented Nov 15, 2024

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
Copy link
Member

@potiuk potiuk left a comment

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
65 checks passed
@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
LefterisXefteris pushed a commit to LefterisXefteris/airflow that referenced this pull request Jan 5, 2025
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