SNOWFLAKE database roles

When an account is provisioned, the SNOWFLAKE database is automatically imported. The database is an example of Snowflake using Secure Data Sharing to provide object metadata and other usage metrics for your organization and accounts.

Access to schema objects in the SNOWFLAKE database is controlled by different database roles. The following sections describe each SNOWFLAKE database role, its associated privileges, and the associated schema objects the role is granted access to.

ACCOUNT_USAGE schema

ACCOUNT_USAGE schemas have four defined SNOWFLAKE database roles, each granted the SELECT privilege on specific views.

Role

Purpose and Description

OBJECT_VIEWER

The OBJECT_VIEWER role provides visibility into object metadata.

USAGE_VIEWER

The USAGE_VIEWER role provides visibility into historical usage information.

GOVERNANCE_VIEWER

The GOVERNANCE_VIEWER role provides visibility into policy related information.

SECURITY_VIEWER

The SECURITY_VIEWER role provides visibility into security based information.

ACCOUNT_USAGE Views by Database Role

The OBJECT_VIEWER, USAGE_VIEWER, GOVERNANCE_VIEWER, and SECURITY_VIEWER roles have the SELECT privilege to query Account Usage views in the shared SNOWFLAKE database.

A checkmark (i.e. ✔) indicates the role is granted the SELECT privilege on the view.

View

OBJECT_VIEWER Role

USAGE_VIEWER Role

GOVERNANCE_VIEWER Role

SECURITY_VIEWER Role

COLUMNS View

COMPLETE_TASK_GRAPHS View

DATABASES View

ELEMENT_TYPES View

FIELDS View

FILE_FORMATS View

FUNCTIONS View

HYBRID_TABLES View

INDEXES View

INDEX_COLUMNS View

OBJECT_DEPENDENCIES view

PIPES View

REFERENTIAL_CONSTRAINTS View

SCHEMATA View

SEQUENCES View

STAGES view

TABLE_CONSTRAINTS View

TABLES View

TAGS View

VIEWS View

AUTOMATIC_CLUSTERING_HISTORY View

CLASS_INSTANCES View

CLASSES View

COPY_HISTORY View

DATA_QUALITY_MONITORING_USAGE_HISTORY view

DATA_TRANSFER_HISTORY View

DATABASE_STORAGE_USAGE_HISTORY View

EVENT_USAGE_HISTORY View

EXTERNAL_ACCESS_HISTORY View

HYBRID_TABLE_USAGE_HISTORY View

LOAD_HISTORY View

MATERIALIZED_VIEW_REFRESH_HISTORY View

METERING_DAILY_HISTORY View

METERING_HISTORY View

PIPE_USAGE_HISTORY view

REPLICATION_USAGE_HISTORY View

REPLICATION_GROUP_REFRESH_HISTORY View

REPLICATION_GROUP_USAGE_HISTORY View

SERVICES View

SNOWPARK_CONTAINER_SERVICES_HISTORY View

SEARCH_OPTIMIZATION_HISTORY View

SERVERLESS_TASK_HISTORY View

STAGE_STORAGE_USAGE_HISTORY view

STORAGE_USAGE View

TABLE_STORAGE_METRICS View

TASK_HISTORY view

WAREHOUSE_EVENTS_HISTORY View

WAREHOUSE_LOAD_HISTORY View

WAREHOUSE_METERING_HISTORY View

ACCESS_HISTORY View

AGGREGATE_ACCESS_HISTORY View

AGGREGATE_QUERY_HISTORY View

AGGREGATION_POLICIES View

DATA_CLASSIFICATION_LATEST View

DATA_METRIC_FUNCTION_REFERENCES View

MASKING_POLICIES view

QUERY_ACCELERATION_ELIGIBLE View

QUERY_HISTORY View

POLICY_REFERENCES view

PROJECTION_POLICIES View

ROW_ACCESS_POLICIES View

TAG_REFERENCES view

GRANTS_TO_ROLES view

GRANTS_TO_USERS view

LOGIN_HISTORY View

NETWORK_POLICIES view

NETWORK_RULES view

NETWORK_RULE_REFERENCES view

PASSWORD_POLICIES view

ROLES View

SESSION_POLICIES View

SESSIONS View

USERS view

READER_ACCOUNT_USAGE schema

The READER_USAGE_VIEWER SNOWFLAKE database role is granted SELECT privilege on all READER_ACCOUNT_USAGE views. As reader accounts are created by clients, the READER_USAGE_VIEWER role is expected to be granted to those roles used to monitor reader account use.

View

LOGIN_HISTORY View

QUERY_HISTORY View

RESOURCE_MONITORS View

STORAGE_USAGE View

WAREHOUSE_METERING_HISTORY View

ORGANIZATION_USAGE schema

The ORGANIZATION_USAGE_VIEWER, ORGANIZATION_BILLING_VIEWER, and ORGANIZATION_ACCOUNTS_VIEWER SNOWFLAKE database roles are granted the SELECT privilege on Organization Usage views in the shared SNOWFLAKE database.

View

ORGANIZATION_BILLING_VIEWER Role

ORGANIZATION_USAGE_VIEWER Role

ORGANIZATION_ACCOUNTS_VIEWER Role

ACCOUNTS View

CONTRACT_ITEMS View

LISTING_AUTO_FULFILLMENT_USAGE_HISTORY View

RATE_SHEET_DAILY View

REMAINING_BALANCE_DAILY View

USAGE_IN_CURRENCY_DAILY View

MARKETPLACE_DISBURSEMENT_REPORT View

DATA_TRANSFER_DAILY_HISTORY View

DATA_TRANSFER_HISTORY View

DATABASE_STORAGE_USAGE_HISTORY View

AUTOMATIC_CLUSTERING_HISTORY View

MARKETPLACE_PAID_USAGE_DAILY View

MATERIALIZED_VIEW_REFRESH_HISTORY View

METERING_DAILY_HISTORY View

MONETIZED_USAGE_DAILY View

PIPE_USAGE_HISTORY view

QUERY_ACCELERATION_HISTORY View

REPLICATION_GROUP_USAGE_HISTORY View

REPLICATION_USAGE_HISTORY View

SEARCH_OPTIMIZATION_HISTORY View

STAGE_STORAGE_USAGE_HISTORY view

STORAGE_DAILY_HISTORY View

WAREHOUSE_METERING_HISTORY View

CORE schema

The CORE_VIEWER SNOWFLAKE database role is granted to the PUBLIC role in all Snowflake accounts containing a shared SNOWFLAKE database. The USAGE privilege is granted to all Snowflake-defined functions and bundles in the CORE schema.

Budget class

The BUDGET_CREATOR Snowflake database role is granted the USAGE privilege on the SNOWFLAKE.CORE schema and the BUDGET class in the schema. This grant allows users with the BUDGET_CREATOR role to create instances of the BUDGET class.

For more information, see Create a custom role to create budgets.

Tag objects

The CORE_VIEWER database role is granted the APPLY privilege each Data Classification system tag: SNOWFLAKE.CORE.PRIVACY_CATEGORY and SNOWFLAKE.CORE.SEMANTIC_CATEGORY. These grants allow users with a role that is granted the CORE_VIEWER database role to assign these system tags to columns.

For details, see:

ALERT schema

The ALERT_VIEWER SNOWFLAKE database role is granted the USAGE privilege on the functions defined in this schema.

ML schema

The ML_USER SNOWFLAKE database role is granted to the PUBLIC role in all Snowflake accounts that contain a shared SNOWFLAKE database and allows customers to access and use ML functions.

CORTEX schema

The CORTEX_USER SNOWFLAKE database role allows customers to access Cortex LLM Functions. Initially, this database role is granted to only the ACCOUNTADMIN role. ACCOUNTADMIN must propagate this role to account roles in order to allow users to use Cortex LLM Functions.

Using SNOWFLAKE Database Roles

Administrators can use the GRANT DATABASE ROLE to assign a SNOWFLAKE database role to another role, which can then be granted to a user. This would allow the user to access a specific subset of views in the SNOWFLAKE database.

In this following example a role is created which can be used to view SNOWFLAKE database object metadata, and does the following:

  1. Creates a custom role.

  2. Grants the OBJECT_VIEWER role to the custom role.

  3. Grants the custom role to a user.

To create and grant the custom role, do the following:

  1. Create the CAN_VIEWMD role, using CREATE ROLE that will be used to grant access to object metadata.

    Only users with the USERADMIN system role or higher, or another role with the CREATE ROLE privilege on the account, can create roles.

    CREATE ROLE CAN_VIEWMD COMMENT = 'This role can view metadata per SNOWFLAKE database role definitions';
    
    Copy
  2. Grant the OBJECT_VIEWER role to the CAN_VIEWMD role.

    Only users with the OWNERSHIP role can grant SNOWFLAKE database roles. For additional information, refer to GRANT DATABASE ROLE.

    GRANT DATABASE ROLE OBJECT_VIEWER TO ROLE CAN_VIEWMD;
    
    Copy
  3. Assign CAN_VIEWMD role to user smith.

    Only users with the SECURITYADMIN role can grant roles to users. For additional options, refer to GRANT ROLE.

    GRANT ROLE CAN_VIEWMD TO USER smith;
    
    Copy