Snowflake
Connect & Ingest data from / to a Snowflake database
Setup
The following credentials keys are accepted:
account(required) -> The hostname or account the instance (eg.pua90768.us-east-11)user(required) -> The username to access the instancedatabase(required) -> The database name of the instancepassword(optional) -> The password to access the instanceschema(optional) -> The default schema to userole(optional) -> The role to access the instancewarehouse(optional) -> The warehouse to usepasscode(optional) -> Specifies the passcode provided by Duo when using multi-factor authentication (MFA) for login.authenticator(optional) -> Specifies the authenticator to use to login (e.g.snowflake,snowflake_jwt,externalbrowser,oauth,programmatic_access_token,username_password_mfa).token(optional since v1.5.1) -> Specifies the token for OAuth or PAT authentication. Required when usingauthenticator=programmatic_access_token.private_key(optional) -> Specifies the private key body or file path to use.private_key_passphrase(optional) -> Specifies the private key file passphrase.max_chunk_download_workers(optional) -> Specifies the Maximum Number of Result Set Chunk Downloader (integer).custom_json_decoder_enabled(optional) -> Specifies to use the Custom JSON Decoder for Parsing Result Set (trueorfalse).internal_stage(optional) -> Specifies a custom internal stage to use for bulk operations. If not provided, Sling will attempt to create a stage in the default schema namedSLING_SCHEMA.SLING_STAGING.copy_method(optional) -> Specifies to use the platform to use for loading/unloading (DEFAULT,AWS,AZURE). ForAWSorAZURE, you'll need to provide the necessary credentials, such asaws_bucket,aws_access_key_idandaws_secret_access_key, for AWS, orazure_account,azure_containerandazure_sas_svc_urlfor AZURE.
Using sling conns
sling connsHere are examples of setting a connection named SNOWFLAKE. We must provide the type=snowflake property:
$ sling conns set SNOWFLAKE type=snowflake account=<account> user=<user> database=<database> password=<password> role=<role>
# Or use url
$ sling conns set SNOWFLAKE url="snowflake://myuser:[email protected]/mydatabase?schema=<schema>&role=<role>"Environment Variable
export SNOWFLAKE='snowflake://myuser:[email protected]/mydatabase?schema=<schema>&role=<role>'
# use JSON format
export SNOWFLAKE_CONN='{ "type": "snowflake", "account": ..., "private_key": "<private-key-file-path>", "private_key_passphrase": "<passphrase>" }'
# use YAML format (with new lines)
export SNOWFLAKE='
type: snowflake
account: <account>
user: <user>
password: <password>
database: <database>
schema: <schema>
role: <role>
warehouse: <warehouse>
private_key: |
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG7w0BAQEFAASCBKgwggSkAgEAAoIBAQDFWDdPxN7sKH/i
......
SxUARJ4Rd2euQIEMqSY2UVPlNSaZK4wEq12jhXEM98cINVyKomJcThOHblz5IbV6
+5I2kK6DCYSY2zm0xzYqeGFN
-----END PRIVATE KEY-----
'Sling Env File YAML
See here to learn more about the sling env.yaml file.
connections:
# Standard password authentication
SNOWFLAKE:
type: snowflake
account: <account>
user: <user>
password: <password>
database: <database>
schema: <schema>
role: <role>
warehouse: <warehouse>
# Key-pair authentication
SNOWFLAKE_JWT:
type: snowflake
account: <account>
user: <user>
database: <database>
schema: <schema>
role: <role>
warehouse: <warehouse>
authenticator: snowflake_jwt
private_key: |
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG7w0BAQEFAASCBKgwggSkAgEAAoIBAQDFWDdPxN7sKH/i
......
SxUARJ4Rd2euQIEMqSY2UVPlNSaZK4wEq12jhXEM98cINVyKomJcThOHblz5IbV6
+5I2kK6DCYSY2zm0xzYqeGFN
-----END PRIVATE KEY-----
# Programmatic Access Token (PAT) authentication
SNOWFLAKE_PAT:
type: snowflake
account: <account>
user: <user>
database: <database>
schema: <schema>
role: <role>
warehouse: <warehouse>
authenticator: programmatic_access_token
token: <token> # Your PAT token
# MFA authentication (with token caching)
SNOWFLAKE_MFA:
type: snowflake
account: <account>
user: <user>
password: <password>
database: <database>
schema: <schema>
role: <role>
warehouse: <warehouse>
authenticator: username_password_mfa
# URL format
SNOWFLAKE_URL:
url: "snowflake://myuser:[email protected]/mydatabase?schema=<schema>&role=<role>"If you are facing issues connecting, please reach out to us at [email protected], on discord or open a Github Issue here.
Last updated
Was this helpful?