Access control framework


OWNERSHIP privilege

When a user logs in to Snowflake, that users default primary role gets activated for the current session. In addition the user may also have secondary roles that may also get activated for that session if they have been configured that way at the login stage or the user configuration stage.

In Snowflake users do not own objects, rather Ownership is a privilege that is granted to the primary role to which the user belongs to and is active during the creation of that object. Which means all users belonging to that same role also gets the ownership.

Note

A role owner (the role that has the OWNERSHIP privilege on the role) does not inherit the privileges of the owned role. Privilege inheritance is only possible within a role hierarchy.


How Role Activation Works at Login

When a user connects to the system (like Snowflake), the active role for their session is determined by the following hierarchy:

PriorityScenarioActive Role Set
1stRole explicitly specified in the connection string/interface (e.g., using a driver, API call, or web interface dropdown).The specified role (if it has been granted to the user).
2ndNo role was specified in the connection, but the user has a Default Role set on their profile.The Default Role is automatically used as the primary role.
3rdNo role was specified, and the user does not have a Default Role set.The system-defined PUBLIC role is automatically used.

Account Roles vs Database Roles 

FeatureRegular Role (Account Role)Database Role
Scope of PrivilegesAccount-Wide: Can hold privileges on any object in the Snowflake account (databases, schemas, warehouses, users, etc.).Database-Specific: Can only hold privileges on objects within the database in which it was created (schemas, tables, views, etc.).
Direct ActivationYes. Can be directly set as the user's DEFAULT_ROLE or explicitly activated in a session using USE ROLE.No. Cannot be activated directly in a user session.
Granting to UsersYes. Can be granted directly to a user.No (Traditionally). Can only be granted to a Regular Role (Account Role) or a Database Role within the same database. However, recent Snowflake updates have made it possible to grant a Database Role directly to a user in some configurations.
PurposeUsed to define a user's functional job role (e.g., ANALYST, DATA_ENGINEER) or a top-level access group.Used to define object-level access within a database (e.g., SALES_DB.READ_ONLY, HR_DB.DATA_OWNER).
OwnershipOwned by another Account Role (usually USERADMIN or a custom security role).Owned by the Database where it was created.



Comments