Authorize Snowflake

Authorize your Snowflake Data Warehouse and sync data with Stacksync

Adding Credentials to Stacksync

1. Find the credentials for your Snowflake instance.

Note the database name, schema name and the account identifier.

Account Identifier uniquely identifies a Snowflake account within your organization. It is a combination of your organization name and account name. It can be found in the Snowflake web interface.

Learn More

2. Run the setup script in Snowflake

  1. Log in to you Snowflake account.

  2. Copy the following script which will create a new Stacksync role, user with the necessary permissions.

-- create the variables for user and role details
set role_name = 'STACKSYNC_ROLE';
set user_name = 'STACKSYNC_USER'; -- enter the username
set user_password = 'STACKSYNC_PASSWORD_#125$'; -- enter the password
set warehouse_name = 'COMPUTE_WH'; -- enter the warehouse you want to use
set database_name = 'STACKSYNC_TEST';

-- change role to security admin to create user and role
use role securityadmin;

-- create the Stacksync Role
create role if not exists identifier($role_name);
grant role identifier($role_name) to role SYSADMIN;

 -- create a user for Stacksync
create user if not exists identifier($user_name)
password = $user_password
default_role = $role_name
default_warehouse = $warehouse_name;

-- grant Stacksync role to the new user
grant role identifier($role_name) to user identifier($user_name);

-- change role to accountadmin to grant permissions to the Stacksync Role
use role accountadmin;

-- grant Stacksync role access to warehouse
grant usage on warehouse identifier($warehouse_name) to role identifier($role_name);

-- grant Stacksync role access to database and create schemas
grant usage on database identifier($database_name) to role identifier($role_name);
grant create schema on database identifier($database_name) to role identifier($role_name);

-- select the database
use database identifier($database_name);

-- grant previlages to the all the schemas you want to sync (This example is for the PUBLIC schema)
-- Create tables and stream previlages.
grant usage on schema PUBLIC to role identifier($role_name);
grant create table on schema PUBLIC to role identifier($role_name);
grant create stream on schema PUBLIC to role identifier($role_name);
grant select on all tables in schema PUBLIC to role identifier($role_name);
grant select on future tables in schema PUBLIC to role identifier($role_name); -- (optional, for future tables)

-- repeat the steps above for all Schemas you want to sync.

3. Select Snowflake in the Create Base page in Stacksync.

4 Enter the credentials for Snowflake.

Last updated