Concepts

Data hierarchy

Virtual warehouses

Access control

In Snowflake, privileges assigned to roles or users allow access to securable objects. Roles can be assigned to users or other roles. Granting a role to another role creates a role hierarchy

Who can grant privileges

Secondary roles

use secondary roles

-- use all roles that have been granted to the user
use secondary roles all;

The ACCOUNTADMIN role

ACCOUNTADMIN role is the most powerful role in the system.

Cheatsheet

Check permissions

use show grants statement

-- Lists all the roles granted to the current user
show grants;
-- Lists all privileges and roles granted to the role
show grants to role public;
-- Lists all users and roles to which the role has been granted
show grants of role accountadmin;

Check current role

use current_role and current_secondary_roles functions

-- primary role
select current_role();
-- secondary roles
select current_secondary_roles();

SQL commands

Flow operators