Snowflake中db_prod库analyst_legacy_test角色未来授权失效问题
Snowflake未来权限失效问题:无法访问新建表/视图的排查与解决
问题现象
执行数据库级未来权限授权后,analyst_legacy_test角色仅能访问db_prod库中已存在的表和视图,无法访问其他角色后续创建的新表/视图。
执行的授权语句
use role securityadmin; grant usage on database db_prod to role analyst_legacy_test; grant usage on all schemas in database db_prod to role analyst_legacy_test; grant select on all tables in database db_prod to role analyst_legacy_test; grant select on all views in database db_prod to role analyst_legacy_test; grant usage on future schemas in database db_prod to role ANALYST_LEGACY_TEST; grant select on future tables in database db_prod to role analyst_legacy_test; grant select on future views in database db_prod to role ANALYST_LEGACY_TEST;
问题原因
核心冲突是跨角色的Schema级未来授权优先级覆盖了数据库级未来授权。Snowflake的权限优先级规则中,Schema级未来授权优先级高于数据库级,但官方文档未明确说明该优先级冲突会跨角色生效:当有其他角色拥有该数据库下Schema级的未来授权时,数据库级的未来授权会被忽略,导致analyst_legacy_test无法继承新建对象的权限。
解决方案
- 检查并移除所有角色在
db_prod数据库下的Schema级未来授权,恢复数据库级未来授权的生效 - 为
analyst_legacy_test角色直接授予Schema级的未来授权(替代原数据库级授权),示例语句:use role securityadmin; grant usage on future schemas in database db_prod to role analyst_legacy_test; grant select on future tables in all schemas in database db_prod to role analyst_legacy_test; grant select on future views in all schemas in database db_prod to role analyst_legacy_test;
内容的提问来源于stack exchange,提问作者will dunlap
相关产品推荐
相关产品推荐

