Back to Utils

Snowflake · View

privilege_changes

All GRANT and REVOKE statements, regardless of the role used. Includes failed attempts. Provides a complete audit trail of changes to privileges and access.

Source: SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY · Latency: ~45min

ColumnDescription
dateDate
user_nameUser
role_nameRole used
query_typeGRANT or REVOKE
execution_statusSUCCESS, FAIL or INCIDENT
statementFull query text

Source code

create_admin_views.sql
create or replace view privilege_changes
    comment = 'GRANT and REVOKE statements with the user and role that executed them (source: SNOWFLAKE.ACCOUNT_USAGE)'
as
select start_time::date as date
     , user_name
     , role_name
     , query_type
     , execution_status
     , query_text as statement
  from snowflake.account_usage.query_history
 where query_type in ('GRANT', 'REVOKE')
 order by start_time desc;