【发布时间】:2021-09-23 08:31:14
【问题描述】:
我创建了一个我认为非常标准的用户,可以访问可以查询单个表的单个角色:
create user new_user;
alter user new_user set password = 'some_pw';
create role new_role;
alter user new_user set default_warehouse = 'compute_wh';
alter user new_user set default_role = 'new_role';
grant role new_role to user new_user;
grant usage on warehouse compute_wh to role new_role;
grant usage on schema my_schema to new_role;
grant usage on database my_db to role new_role;
grant select on my_db.my_schema.my_table to role new_role;
GRANT OPERATE ON WAREHOUSE COMPUTE_WH TO ROLE new_role;
但是,当我在 SQL 客户端(如 DBeaver)中设置此用户时,我无法运行任何查询:
USE WAREHOUSE COMPUTE_WH; -- fails even here
USE DATABASE my_db;
SELECT * FROM my_db.my_schema.my_table;
SQL 错误 [2043] [02000]:SQL 编译错误:对象没有 存在,或无法执行操作。
我可能会缺少哪些额外权限?
【问题讨论】:
-
如果您以该用户身份登录 Snowflake WebUI,您可以运行这 3 条语句吗?我认为您还需要在架构上授予使用权限
-
@NickW 是对的,您的用户 new_user 也需要在架构上授予使用权限
-
您还需要将角色授予用户。设置默认角色不会将角色授予用户
-
角色已授予用户,并且已在架构上授予 select。不幸的是还是同样的错误。
-
您需要在架构上使用 USAGE,而不是 SELECT
标签: permissions snowflake-cloud-data-platform ansi-sql