Learning Objectives
By the end of this chapter, you will be able to:
- Describe Role-Based Access Control (RBAC) fundamentals, including role hierarchy and role types (account roles such as SYSADMIN, USERADMIN, SECURITYADMIN, ACCOUNTADMIN, custom roles, and database roles).
- Identify privileges (USAGE, SELECT, INSERT, UPDATE, DELETE, OWNERSHIP) and how they are granted to roles.
- Describe object access by role, including the use of INFORMATION_SCHEMA and the PUBLIC schema.
- Demonstrate understanding of session context (CURRENT_ROLE, USE ROLE, USE WAREHOUSE, USE DATABASE, USE SCHEMA).
- Transfer ownership of objects between roles.
- Manage the schema lifecycle using CREATE SCHEMA and DROP SCHEMA.
- Apply basic SQL constructs, including SELECT *, SELECT * EXCLUDE (column_list), and LIMIT.
Executive Summary
- Snowflake's access model is purely role-based: privileges attach to roles, never directly to users, and a user gains capability only by activating a role that holds the right grant on the right object.
- Account roles form a fixed hierarchy under ACCOUNTADMIN, with USERADMIN owning user and role lifecycle, SECURITYADMIN owning grants across the account, and SYSADMIN owning the object graph beneath it.
- Each operation against a database object resolves through a chain of USAGE grants on the parent containers plus the action-specific grant on the object itself, so revoking USAGE on a database silently blocks every query against tables inside it.
- Session context (role, warehouse, database, schema) is mutable state inside a single session; it is set with USE statements, observed with CURRENT_ROLE and related context functions, and reset every time the user reconnects.
Assumptions
- All examples use uppercase identifiers without surrounding double quotes, which matches Snowflake's default identifier-folding behavior and the convention used in the official documentation.
- All SQL is dialect-correct for Snowflake; constructs such as SELECT * EXCLUDE and the colon-path semi-structured operator are extensions that do not exist in standard ANSI SQL.
- Region and edition are unspecified: the role model and SQL constructs covered here behave the same on Standard, Enterprise, Business Critical, and Virtual Private Snowflake.
- Terms defined in Chapter 1 (the three-layer architecture, virtual warehouse, database, schema, table, view, PUBLIC schema, INFORMATION_SCHEMA, VARIANT) are used here without re-definition.
