Skip to main content

Configure Snowflake permission setup

Last updated on October 4, 2023

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

  1. Log in to Snowflake with an account that has the ACCOUNTADMIN role granted.

  2. Create a new role using the following command:

    CREATE ROLE <role_name>;

Create user

  1. Create a new user using the following command:

    CREATE USER <user_name>;

Grant role to user

  1. 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

  1. Set the default role to the user using the following command:

    ALTER USER <user_name> SET DEFAULT_ROLE = <role_name>;
  2. 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

  1. Create and grant ownership to the database

    CREATE DATABASE <database_name>;
  2. Grant ownership of the database to the desired role using the following command:

    GRANT OWNERSHIP ON DATABASE <database_name> TO ROLE <role_name>;
  3. 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

  1. Grant usage of the warehouse to the role using the following command:

    GRANT USAGE ON WAREHOUSE <warehouse_name> TO ROLE <role_name>;