Snowflake Database
Follow our setup guide to connect your Snowflake data warehouse to Gravity.
To connect Snowflake to Gravity, you need the following:
- A Snowflake account with the appropriate permissions to create a user and warehouse for Gravity.
- Gravity account owner permission to add destinations.
IMPORTANT: In Snowflake, if you use double quotes around an identifier name, it makes the identifier name case-sensitive. We recommend using thecreate <identifier> <identifier_name>
or thecreate <identifier> "IDENTIFIER_NAME"
format. See Snowflake's documentation on identifiers for more information.
You can choose to create an exclusive warehouse for Gravity or use an existing warehouse:
- You can create and use an exclusive warehouse for Gravity. The benefit of this route is that Gravity operations will never contend with your queries for resources and this is useful when it comes to diagnosing performance issues if you face concurrency/waiting problems in your data warehouse.
- You can use a shared warehouse to reduce your warehouse running cost. Gravity does not consume much resources through loading data incrementally but it will possibly drive longer wait times if you share a warehouse with multiple applications. This is not a Gravity issue but a warehouse/cost design decision you need to make.
- 1.Log in to your Snowflake data warehouse.
- 2.
- 3.DO NOT execute this script yet. See Step 4 for notes on which items you need to replace, including the password.begin;-- create variables for user / password / role / warehouse / database (needs to be uppercase for objects)set role_name = 'GRAVITY_ROLE';set user_name = 'GRAVITY_USER';set user_password = 'SETPASSWORD';set warehouse_name = 'GRAVITY_WAREHOUSE';set database_name = 'GRAVITY_DATABASE';-- change role to securityadmin for user / role stepsuse role securityadmin;-- create role for gravitycreate role if not exists identifier($role_name);grant role identifier($role_name) to role SYSADMIN;-- create a user for gravitycreate user if not exists identifier($user_name)password = $user_passworddefault_role = $role_namedefault_warehouse = $warehouse_name;grant role identifier($role_name) to user identifier($user_name);-- change role to sysadmin for warehouse / database stepsuse role sysadmin;-- create a warehouse for gravitycreate warehouse if not exists identifier($warehouse_name)warehouse_size = xsmallwarehouse_type = standardauto_suspend = 60auto_resume = trueinitially_suspended = true;-- create database for gravitycreate database if not exists identifier($database_name);-- grant gravity role access to warehousegrant USAGEon warehouse identifier($warehouse_name)to role identifier($role_name);-- grant gravity access to databasegrant CREATE SCHEMA, MONITOR, USAGEon database identifier($database_name)to role identifier($role_name);-- change role to ACCOUNTADMIN for STORAGE INTEGRATION support (only needed for Snowflake on GCP)use role ACCOUNTADMIN;grant CREATE INTEGRATION on account to role identifier($role_name);use role sysadmin;commit;