Snowflake Connection

The Snowflake connection type enables integrations with Snowflake.

Authenticating to Snowflake

Authenticate to Snowflake using the Snowflake python connector default authentication.

Default Connection IDs

Hooks, operators, and sensors related to Snowflake use snowflake_default by default.

Configuring the Connection

Login

Specify the snowflake username.

Password

Specify the snowflake password. For public key authentication, the passphrase for the private key.

Schema (optional)

Specify the snowflake schema to be used.

Extra (optional)

Specify the extra parameters (as json dictionary) that can be used in the snowflake connection. The following parameters are all optional:

  • account: Snowflake account name.

  • database: Snowflake database name.

  • region: Warehouse region.

  • warehouse: Snowflake warehouse name.

  • role: Snowflake role.

  • authenticator: To connect using OAuth set this parameter oauth.

  • refresh_token: Specify refresh_token for OAuth connection.

  • private_key_file: Specify the path to the private key file.

  • private_key_content: Specify the content of the private key file.

  • session_parameters: Specify session level parameters.

  • insecure_mode: Turn off OCSP certificate checks. For details, see: How To: Turn Off OCSP Checking in Snowflake Client Drivers - Snowflake Community.

  • host: Target Snowflake hostname to connect to (e.g., for local testing with LocalStack).

  • port: Target Snowflake port to connect to (e.g., for local testing with LocalStack).

URI format example

If serializing with Airflow URI:

export AIRFLOW_CONN_SNOWFLAKE_DEFAULT='snowflake://user:password@/db-schema?account=account&database=snow-db&region=us-east&warehouse=snow-warehouse'

When specifying the connection as an environment variable in Airflow versions prior to 2.3.0, you need to specify the connection using the URI format.

Note that all components of the URI should be URL-encoded.

JSON format example

If serializing with JSON:

export AIRFLOW_CONN_SNOWFLAKE_DEFAULT='{
    "conn_type": "snowflake",
    "login": "user",
    "password": "password",
    "schema": "db-schema",
    "extra": {
        "account": "account",
        "database": "database",
        "region": "us-east",
        "warehouse": "snow-warehouse"
    }
}'

Was this entry helpful?