Snowflake is a cloud-based data platform that enables organizations to manage and analyze vast amounts of data efficiently and securely. By integrating Snowflake with Upriver, you can unlock automated data governance, prevent issues at the source, and ensure consistency across your entire data pipeline. Upriver empowers your teams to build trusted, high-quality data that drives business success.
Upriver only supports snowflake in a SaaS deployment, or in a hybrid deployment on a different cloud provider.
Prepare Your Snowflake Environment
To connect Upriver to Snowflake, you need to create specific roles and permissions within Snowflake. This is done using an SQL script provided by Upriver.
Grant Upriver access
Replace the placeholder <UPRIVER_PUBLIC_KEY> with the key provided to you by Upriver.
If you change any of the other parameters (such as the role or user name), please let the Upriver representative assisting you know the values you've set.
-- setup variables for the user/role/warehouse you'll create-- if you change any of these, let an upriver representative know the values you've usedset user_name ='UPRIVER_USER';set role_name ='UPRIVER_ROLE';set warehouse_name ='UPRIVER_WAREHOUSE';-- change role for user/ role setupuserole accountadmin;-- create the role for Uprivercreateroleifnotexists identifier($role_name);-- create the user for Upriver and setup default role/warehouse for itcreateuserifnotexists identifier($user_name)default_role = $role_namedefault_warehouse = $warehouse_name;-- allow Upriver to log in to the user using an rsa keyalteruser identifier($user_name) set RSA_PUBLIC_KEY='<UPRIVER_PUBLIC_KEY>';-- grant the user access to the rolegrantrole identifier($role_name) to user identifier($user_name);-- create the warehouse for Uprivercreate warehouse ifnotexists identifier($warehouse_name)with warehouse_size ='xsmall', warehouse_type ='standard', auto_suspend =120, auto_resume = true, initially_suspended = true;-- give Upriver role access to the warehousegrant usage on warehouse identifier($warehouse_name) torole identifier($role_name);-- give Upriver role access to query history, monitoring access and tasksgrant imported privileges ondatabase"SNOWFLAKE"toROLE identifier($role_name);grantdatabaserole USAGE_VIEWER torole UPRIVER_ROLE;grant monitor execution on account torole identifier($role_name);
Provide access to your data
After you've created the role for Upriver to use, you need to grant the role access to the data you wish to monitor. This section will provide multiple methods to grant Upriver read-only access to your data, please choose one according to your needs.
Provide access to specific schemas
Replace <YOUR_DATABASE_NAME> and <YOUR_SCHEMA_NAME> with the schema you wish to give Upriver access to. If you've used a custom name for the upriver role in it's creation, replace role_name with it as well.
This option uses schema level grants. In snowflake, if a schema has schema level future grants, it ignore database level future grants defined for other roles. If you use database level future grants in your workspace, you should grant access on a database level instead.
Provide read-only access to an entire database
Replace <YOUR_DATABASE_NAME> with the schema you wish to give Upriver access to. If you've used a custom name for the upriver role in it's creation, replace role_name with it as well.
This option uses database level grants. In snowflake, if a schema has schema level future grants, it ignore database level future grants defined for other roles. If you use schema level future grants in your workspace, please refer to the previous section instead.
Provide access to a shared table
Shared tables permissions work differently than normal tables, and read access can be granted using the following command.
Replace <YOUR_DATABASE_NAME> with the schema you wish to give Upriver access to. If you've used a custom name for the upriver role in it's creation, please replace role_name with it as well.
Limiting access by IP
If you're using network policies to limit access to your snowflake, you'll need to add a policy to allow Upriver access. In a hybrid deployment, the address will be determined based on your deployment. You may contract an Upriver representative for help figuring out the IP used.
Database: Enter the name of the Snowflake database configured in Step 1.
Schema: Specify the schema within the database that Upriver should access.
Table: Provide the table name you want Upriver to connect to or monitor.
Monitor and Manage Your Data
With the Snowflake datasource configured, Upriver will begin tracking data activity, identifying potential issues, and providing insights to ensure the quality and consistency of your data pipeline.
-- setup variables for the schema you wish to grant access to
set database_name = '<YOUR_DATABASE_NAME>';
set schema_name = '<YOUR_SCHEMA_NAME>';
set role_name = 'UPRIVER_ROLE';
-- the full name of the schema
set full_schema_name = $database_name || '.' || $schema_name;
-- grant the upriver role access to the schema
grant usage on database identifier($database_name) to role identifier($role_name);
grant usage on schema identifier($full_schema_name) to role identifier($role_name);
grant select on all tables in schema identifier($full_schema_name) to role identifier($role_name);
grant select on future tables in schema identifier($full_schema_name) to role identifier($role_name);
grant select on all views in schema identifier($full_schema_name) to role identifier($role_name);
grant select on future views in schema identifier($full_schema_name) to role identifier($role_name);
grant select on all external tables in schema identifier($full_schema_name) to role identifier($role_name);
grant select on future external tables in schema identifier($full_schema_name) to role identifier($role_name);
grant select on all event tables in schema identifier($full_schema_name) to role identifier($role_name);
grant select on future event tables in schema identifier($full_schema_name) to role identifier($role_name);
grant select on all dynamic tables in schema identifier($full_schema_name) to role identifier($role_name);
grant select on future dynamic tables in schema identifier($full_schema_name) to role identifier($role_name);
-- setup variables for the database you wish to grant access to
set database_name = '<YOUR_DATABASE_NAME>';
set role_name = 'UPRIVER_ROLE';
-- grant the upriver role access to the database
grant usage on database identifier($database_name) to role identifier($role_name);
grant usage on all schemas in database identifier($database_name) to role identifier($role_name);
grant usage on future schemas in database identifier($database_name) to role identifier($role_name);
grant select on all tables in database identifier($database_name) to role identifier($role_name);
grant select on future tables in database identifier($database_name) to role identifier($role_name);
grant select on all views in database identifier($database_name) to role identifier($role_name);
grant select on future views in database identifier($database_name) to role identifier($role_name);
grant select on all external tables in database identifier($database_name) to role identifier($role_name);
grant select on future external tables in database identifier($database_name) to role identifier($role_name);
grant select on all event tables in database identifier($database_name) to role identifier($role_name);
grant select on future event tables in database identifier($database_name) to role identifier($role_name);
grant select on all dynamic tables in database identifier($database_name) to role identifier($role_name);
grant select on future dynamic tables in database identifier($database_name) to role identifier($role_name);
-- setup variables for the shared database you wish to grant access to
set database_name = '<YOUR_DATABASE_NAME>';
set role_name = 'UPRIVER_ROLE';
-- grant the upriver role access to the shared database
grant imported privileges on database identifier($database_name) to role identifier($role_name);