如何显示对 Snowflake 中所有角色的所有资助?

How do I show all grants to all roles in Snowflake?

在雪花中,我知道我可以展示角色:

show roles

我知道我可以显示特定角色的授权并通过查询访问这些角色:

show grants to role dev_role;
select * from table(RESULT_SCAN (LAST_QUERY_ID()));

我想在一个 table 中显示所有角色的所有资助。我最好的猜测是编写一个循环遍历所有角色名称的过程,执行上面的代码,并将结果输出到 table.

有更好的方法吗?

遗憾的是,目前没有更好的方法来积累授权信息。我目前的解决方案正是您所描述的。

您是否有权访问名为 snowflake? If not then you may need to ask an accountadmin to provide you the IMPORTED PRIVILEGES grant as explained here 的共享数据库。

无论如何,如果您有权访问此数据库,那么我认为您应该能够从 GRANTS_TO_ROLES 视图中获取所需的信息:

select * 
from snowflake.account_usage.grants_to_roles;