Configure Snowflake permission setup
Overview
Proper permission setup in Snowflake is crucial for the Snowflake connector to function effectively.
This section outlines the steps to create roles, users, databases, grant ownership, and assign roles to users for seamless integration with the Snowflake connector.
Create role
Log in to Snowflake with an account that has the
ACCOUNTADMIN
role granted.Create a new role using the following command:
CREATE ROLE <role_name>;
Create user
Create a new user using the following command:
CREATE USER <user_name>;
Grant role to user
Grant the role you created to the user who will be responsible for the database using the following command:
GRANT ROLE <role_name> TO USER <user_name>;
Set default role and warehouse to user
Set the default role to the user using the following command:
ALTER USER <user_name> SET DEFAULT_ROLE = <role_name>;
Set the default warehouse to the user using the following command:
ALTER USER <user_name> SET DEFAULT_WAREHOUSE = <warehouse_name>;
Create and grant ownership to the database and schema
Create and grant ownership to the database
CREATE DATABASE <database_name>;
Grant ownership of the database to the desired role using the following command:
GRANT OWNERSHIP ON DATABASE <database_name> TO ROLE <role_name>;
Grant ownership of the schema to the desired role using the following command:
GRANT OWNERSHIP ON SCHEMA <database_name>.<schema> TO ROLE <role_name>;
Grant warehouse usage to role
Grant usage of the warehouse to the role using the following command:
GRANT USAGE ON WAREHOUSE <warehouse_name> TO ROLE <role_name>;