授予雪花中特定视图的使用权

grant usage on particular view in snowflake

我的数据库(即 myDb)中角色 analyst.

的 snowflake 中有超过 10 个视图

现在,我创建了一个新角色,即developer,我想给

grant select on view <> to role developer

允许一个粒子视图(即test_view)。

如何授予对 snowflake 中某一特定视图的访问权限?

注意:考虑架构名称public

你几乎和你猜的一模一样。 VIEW 为 schemaObjectPrivileges

CREATE ROLE developer;

CREATE VIEW test.test.test_view AS SELECT 1 AS id;

GRANT SELECT ON VIEW test.test.test_view TO ROLE developer;

SHOW GRANTS TO ROLE developer;

除了在视图上授予 select 之外,您还需要在数据库和架构上授予使用权

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