Connect to Snowflake
Check out our step-by-step video showing how to connect your Snowflake database to Chartio:
Requirements
- Snowflake warehouse must be set to AUTO-SUSPEND. Refer below for more information about suspended warehouses.
- ACCOUNTADMIN role is required to add a new role and user.
1. Create a Snowflake read-only user
a. Create a read-only role
A read-only role is recommended to ensure the role assigned to the user connecting to Chartio has the least amount of privileges required. You must grant this role usage privileges on the warehouse, database, and schema as well as the select privilege on all tables you want to access in Chartio. Open your Snowflake Worksheets page to run the statements below in the console.
-
Create the role by running the following statement:
CREATE ROLE IF NOT EXISTS READ_ONLY;
-
Grant privileges by sequentially running each of the following GRANT statements to grant the appropriate privileges to the read-only role. Do not include the angle brackets (
<>
):a. Warehouse usage
GRANT USAGE ON WAREHOUSE <warehouse_name> TO ROLE <role_name>;
b. Database usage
GRANT USAGE ON DATABASE <database_name> TO ROLE <role_name>;
c. Schema usage. Run this command for each schema you’d like to add to Chartio.
GRANT USAGE ON SCHEMA <schema_name> TO ROLE <role_name>;
d. Grant access to all tables in a schema…
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO ROLE <role_name>;
… or specific tables in a schema:
GRANT SELECT ON TABLE <database_name>.<schema_name>.<table_name> TO ROLE <role_name>;
b. Create the read-only user
We recommend creating a new user that will only be used to connect to Chartio and grant this user the read-only role that was created in the previous step. Password requirements are a minimum of 8 characters and must include at least one number and symbol.
Again, do not include the angle brackets (<>
).
CREATE USER IF NOT EXISTS <username> PASSWORD = '<password>' MUST_CHANGE_PASSWORD = FALSE DEFAULT_ROLE = READ_ONLY;
GRANT ROLE READ_ONLY TO USER <username>;
2. Allow Chartio’s IP address
By default, Snowflake instances are open to every IP address, so no action is required. But if you have an existing Snowflake network policy, please follow the instructions in the Snowflake section of our documentation for how to allow Chartio’s IP address.
3. Obtain Snowflake connection details
All connection details are case-sensitive. Snowflake stores object names in uppercase unless you wrap the names in double quotes (""
) when you create the objects. This includes Warehouse Name, Database Name, and Schema Name.
Connection Detail | Detail Description |
---|---|
Account Name | The first part of your Snowflake URL: account-name.region.snowflakecomputing.com |
Account User | The username of the read-only user you created in Step 1 |
User Password | The password of the read-only user |
Database | Click Databases from within your Snowflake console to view a list of databases. |
Warehouse Name | Click Warehouses from within your Snowflake console to view a list of warehouses. Any warehouse in your account will work with any database. |
Region | If not US West Region, your region will be listed in your Snowflake console URL: account-name.region.snowflakecomputing.com |
Schema Name | Click Databases from within your Snowflake console, then click the name of the database you'd like to use. Switch to the Schemas tab to view a list of schemas for that database. Chartio will automatically default the schema to public in the connection form unless a schema name is entered. If you want to add multiple schemas, leave this field blank. |
4. Connect Snowflake to Chartio
Enter the obtained connection details into Chartio’s Snowflake connection form and click Connect.
Remember your Warehouse Name, Database Name, and Schema Name are case-sensitive!
Query comment
To provide more context to where queries to your data source are coming from, Chartio includes metadata to any queries we send using the Snowflake Query Tag parameter; it looks similar to the following:
{
"reason":"chart_editor",
"user_email":"support@chartio.com",
"datasource_id":123456,
"dashboard_slug":"my-dashboard",
"chart_id":1234567,
"datasource_alias":"my data source",
"organization_id":12345,
"dataset_id":1231231,
"is_manual":false,
"dataset_name":"Dataset 1",
"dashboard_id":456456
}
Suspended warehouse
Chartio will automatically resume a suspended warehouse prior to schema refresh. Chartio will not resume a suspended warehouse to run a query.