Snowflake
Access configuration details to connect Soda to a Snowflake data source.
Connection configuration reference
Install the following package:
pip install -i https://pypi.dev.sodadata.io/simple -U soda-snowflakeCore connection:
type: snowflake
name: my_datasource_name
connection:
# Core
account: ${env.SNOWFLAKE_ACCOUNT} # <account locater>.<region>, e.g.,ET23172.eu-west-1
database: <database>
warehouse: <warehouse>
role: <role> # optional, strongly recommended
connection_timeout: 240 # optional
client_session_keep_alive: false # optionalChoose exactly one authentication approach of the four options below.
Supported by Soda
Default (
SnowflakePasswordAuth)External browser (
SnowflakeSSOAuth)key_pair (
SnowflakeKeyPairAuth)OAuth (
SnowflakeOAuthAuth)OAuth client credentials (
SnowflakeClientCredentialsOAuthAuth)
Not supported by Soda
OAuth Authorization Code grant
User/password MFA flows
Workload identity authenticator
Programmatic access token (PAT)
Programmatic access token with external session
1. User + password
2. External browser SSO
3. Key pair (JWT) authentication
You can use the private_key and private_key_passphrase parameters to specify for key pair authentication. In you configuration YML file, add the parameters as per the following example.
4. OAuth 2.0 Client Credentials
Other parameters
Use a values file to store private key authentication values
If you use a private key authentication with Snowflake and have deployed a Soda Agent, you can provide the required private key values in a values.yml file when you deploy or redeploy the agent.
You can also use the values.yml file to store other environment variables for the Soda Agent to use, such as SNOWFLAKE_USER, SNOWFLAKE_ACCOUNT, SNOWFLAKE_PASSPHRASE, etc.
First, run the following command to create a local path to the Snowflake private key. Replace the
local path to the Snowflake private keywith your own value.
Then, add the following to the your
values.ymlfile, adjusting the values to your own specific details.Adjust the
configuration.ymlfile to include the new path in the connection details, as in the following example.Deploy, or redeploy, the agent for the changes to take effect.
Connection test
Test the data source connection:
Supported data types
text
CHAR, VARCHAR, CHARACTER, STRING, TEXT
number
NUMBER, INT, INTEGER, BIGINT, SMALLINT, TINYINT, BYTEINT, FLOAT, FLOAT4, FLOAT8, DOUBLE, DOUBLE PRECISION, REAL
time
DATE, DATETIME, TIME, TIMESTAMP, TIMESTAMPT_LTZ, TIMESTAMP_NTZ, TIMESTAMP_TZ
Troubleshoot
Problem: When testing the connection to your Snowflake data source, Snowflake returns an error message about using the use database command.
Solution: Use the role parameter to specify a Snowflake role that has permission to access the database and schema of your data source.
Though optional, best practice dictates that you provide a value for role. If you do not provide a role, and Snowflake has not assigned a Snowflake System-Defined Role to the user account, Snowflake may, confusingly, deny access to the data source.
Problem: When Soda attempts to connect to your Snowflake data source, it produces a connectivity error that includes something like RuntimeError: Command failed with exit code 2: ..... ocsp_response_validation_cash.lock.
Solution: Use Snowflake's troubleshooting guide to triage OCSP-related connectivity issues.
Problem: You have defined a Group By check and the scan that executes the check yields an error.
Solution: Be aware that, by default, Snowflake returns columns names in uppercase. Therefore, when defining a Group By check, you must specify the custom name of the check in uppercase as in the following example.
Problem: While attempting to connect Soda to a Snowflake data source using proxy parameters, you encounter an error that reads something similar to Could not connect to data source "name_db": 250001 (08001): Failed to connect to DB: mydb.eu-west-1.snowflakecomputing.com:443. Incoming request with IP/Token xx.xxx.xx.xxx is not allowed to access Snowflake.
Solution: When connecting to a Snowflake data source by proxy, be sure to set the new proxy environment variables from the command-line using export statements, as in the following example.
Last updated
Was this helpful?
