Snowflake
Prerequisites
To connect your DataPostie instance to BigQuery, you first need:
- A Snowflake user with the relevant role and permissions to the database, schemas and tables to which you would like to grant access to the DataPostie application.
- An empty "scratch" schema to which this user has full access.
Here is a sample SQL script you can run on your Snowflake instance to create the above:
-- change role to ACCOUNTADMIN
USE ROLE ACCOUNTADMIN;
-- create role for datapostie user
CREATE ROLE IF NOT EXISTS datapostie_role;
GRANT ROLE datapostie_role TO ROLE SYSADMIN;
-- Note that we are not making the datapostie_role a SYSADMIN,
-- but rather granting users with the SYSADMIN role to modify the datapostie_role
-- create a user for DataPostie
CREATE USER IF NOT EXISTS datapostie_user
password = '<enter password here>';
GRANT ROLE datapostie_role TO USER datapostie_user;
ALTER USER datapostie_user
SET default_role = datapostie_role
default_warehouse = '<your-warehouse>';
-- change role
USE ROLE SYSADMIN;
-- grant warehouse privileges to datapostie_role
GRANT ALL PRIVILEGES ON WAREHOUSE <your-warehouse> TO ROLE datapostie_role;
-- grant read only database access (repeat for all database/schemas)
GRANT USAGE ON DATABASE <database> TO ROLE datapostie_role;
GRANT USAGE ON SCHEMA <database>.<schema> TO ROLE datapostie_role;
-- rerun the following any time a table is added to the schema
GRANT SELECT ON ALL TABLES IN SCHEMA <database>.<schema> TO ROLE datapostie_role;
GRANT SELECT ON FUTURE TABLES IN SCHEMA <database>.<schema> TO ROLE datapostie_role;
-- create a schema for DataPostie to write back to
USE DATABASE <database>;
CREATE SCHEMA IF NOT EXISTS datapostie_temp;
USE ROLE ACCOUNTADMIN;
GRANT OWNERSHIP ON SCHEMA datapostie_temp TO ROLE SYSADMIN REVOKE CURRENT GRANTS;
GRANT ALL ON SCHEMA datapostie_temp TO ROLE datapostie_role;
Create your Snowflake Connection
Enter the following details:
- Specify a connection name
- Select
Snowflake
as your connection dialect - Under Host, enter your Snowflake account ID (typically in the form
organization_id
-account_id
) - Under Username, enter the username created in the Prerequisites step
- Under Password, enter the user's password
- Under Parameters, specify a parameter called
database
and specify the main database which contains the schemas you would like to make available to data consumers
Test your Snowflake Connection
After your Snowflake connection is created, click the Test button next to it to ensure it is set up correctly. You can always edit it if need be.