viewsnowflake-cloud-data-platform

grant usage on particular view in snowflake


I have more than 10+ views in my database(i.e. myDb) in snowflake with the role analyst.

Now, I have created a new role i.e. developer and I want to give

grant select on view <> to role developer

permission to one particle view(i.e test_view).

How can I grant access to one particular view in snowflake?

Note: consider the schema name public


Solution

  • Along with granting select on view, you also need to grant usage on the database and schema

    grant usage on database db_name to role developer;
    grant usage on schema db_name.public to role developer;
    grant select on view db_name.public.my_view to role developer;
    

    Operating on a view also requires the USAGE privilege on the parent database and schema

    snowflake-view-privileges