对我尝试在同一区域的两个雪花帐户之间共享的数据库权限进行故障排除

Troubleshoot permissions on a database I am trying to share across two snowflake accounts for same region

我有两个 Snowflake 帐户,需要在同一区域克隆或复制数据库和 tables。

我尝试复制的解决方案:

Data Sharing Intro Reference 我读到:

"Snowflake supports using grants to provide granular access control to selected objects (schemas, tables, secure views, and secure UDFs) in the database (i.e., you grant access privileges for one or more specific objects within the database)."

听起来我可以与我想与帐户共享的数据库共享一个 UDF,但只读功能。已确认:

" ...but cannot perform any of the DML tasks that are allowed in a full account (data loading, insert, update, etc.)."

设置一个帐户作为提供商:

USE ROLE ACCOUNTADMIN;

CREATE MANAGED ACCOUNT reader_acct1
    ADMIN_NAME = user1 , ADMIN_PASSWORD = 'Sdfed43da!44' ,
    TYPE = READER;

//create share
CREATE SHARE Articlelibary_share;

GRANT USAGE ON DATABASE Snapshots TO SHARE Articlelibary_share;

GRANT USAGE ON SCHEMA Snapshots.public TO SHARE Articlelibary_share;

GRANT SELECT ON TABLE Snapshots.public.Articlelibary_TEST TO SHARE Articlelibary_share;

但是我在工作表中收到的错误是:

SQL compilation error: Database 'SNAPSHOTS' does not exist or not authorized.

我发现,当我处于 ACCOUNTADMIN 角色时,我可以看到快照 table,但是,在 SYSADMIN 中,我看不到快照 table。

那么,如何修复 Database/Table 权限以便将其添加到共享?

创建共享和允许访问其他帐户的活动只能由 ACCOUNTADMIN 执行,这就是您看到的错误的原因。

从文档中很清楚:

https://docs.snowflake.net/manuals/user-guide/data-sharing-gs.html#getting-started-with-secure-data-sharing

要执行本主题中描述的任务,您必须使用 ACCOUNTADMIN 角色。