Comment on page
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;content_copy
- 4.If you want to create a new warehouse do not make any changes. If you want to use a shared warehouse to ingest data, change the GRAVITY
_WAREHOUSE
value in the script to the name of the shared warehouse. - 5.Replace the default GRAVITY
_ROLE
, GRAVITY_DATABASE
, GRAVITY_USER
, and SETPASSWORD values with values that conform to your specific naming conventions for those resources. - 6.Run the script.
If you don't have a network policy you need to create one or you can update your policy. The addresses below are Gravity IP Addresses.
To create: Use the
CREATE NETWORK POLICY and an example is here:
CREATE NETWORK POLICY <gravity_ip_whitelist> ALLOWED_IP_LIST = ('
35.242.183.251/32', '
35.246.26.172/32', '
35.197.252.236/32','
35.234.142.96/32', '
35.234.128.102/32', '
34.105.214.159/32');
To update: Use the
ALTER NETWORK POLICY and an example is here
ALTER NETWORK POLICY <your_network_policy_name> SET {[ALLOWED_IP_LIST] = ('
35.242.183.251/32', '
35.246.26.172/32', '
35.197.252.236/32','
35.234.142.96/32', '
35.234.128.102/32', '
34.105.214.159/32')]};
- 1.Log in to your Gravity and click on Destinations, Choose Snowflake
- 2.Insert your Host Name. Port Number and Database Name.
- 3.Insert your User name and Password
- 4.Click Save & Test.
- Test checks connectivity to Snowflake and permission to create schemas and tables on your Snowflake database.
Gravity has now validated the destination and if successful you can add sources or create jobs. If unsuccessful, please go back through the steps above or contact Gravity Support.
Last modified 1yr ago