注册数据

本主题介绍如何注册数据,以便将其链接到 Snowflake Data Clean Room。

受支持对象

以下对象类型可以链接到 Clean Room:

备注

†外部表和 Iceberg 表 必须先启用后 才能在 Clean Room 中使用。

注册数据对象

在用户将数据链接到 Snowflake Data Clean Room 之前,必须先 注册 数据。注册数据可将对象的 USAGE 和 SELECT 权限授予 SAMOOHA_APP_ROLE,由 Clean Room 环境用于访问数据。如果您注册数据库或架构,则所有子对象也会被注册。您必须拥有对象的 MANAGE GRANTS 权限才能链接该对象。

You can register databases, schemas, and objects using the Clean rooms UI or the Clean rooms API. Using the Clean rooms UI is simpler, but requires that you have the ACCOUNTADMIN role. Using the developer APIs, you can register any object on which you have OWNERSHIP privilege without using the ACCOUNTADMIN role.

重要

Registering a database or schema does not register objects added after the registration. You must either register the new object individually or use the Clean rooms UI to navigate to Admin > Snowflake Admin > Database Registration and select Resync.

您只能链接您的账户注册的数据。也就是说,提供商无法链接使用者注册的数据,使用者也无法链接提供商注册的数据。将数据关联到 Clean Room 后,任何有权访问 Clean Room 的人都可以访问这些数据,但须遵守链接方的设置(例如联接和列策略)。

Follow the steps below to register a database, schema, or object using the Clean rooms UI:

  1. Sign in to the Clean rooms UI as an account administrator and then take one of the following steps:

    • 如果使用托管账户,请选择 Admin > My Account

    • 如果使用 Snowflake 账户,请选择 Admin > Snowflake Admin,并以具有 ACCOUNTADMIN 角色的用户身份登录 Snowflake。

  2. 选择 Admin > Snowflake Admin

  3. 选择 Log in to Snowflake,并以具有 ACCOUNTADMIN 角色的用户进行身份验证。

  4. 要在账户中启用外部表或 Iceberg 表,请启用 External & Iceberg Tables 切换开关。

  5. Access management for Snowflake objects 部分中,选择 Edit,然后选择数据库、架构或对象,以使其数据可供此账户中的用户链接。

  6. 选择 Save

Registering tables or views that have Snowflake policies applied

If you want to link in data that has a Snowflake policy applied, and the Snowflake policy is stored in a different database than the source data, you must grant reference usage on the policy database to clean rooms. You can do this either once per account, or once per clean room.

Grant reference usage once per account

To grant reference usage to a database once per account, and have it granted automatically for each clean room, grant reference usage to SAMOOHA_APP_ROLE by running the following SQL command. Replace the database placeholder with your database name.

GRANT REFERENCE_USAGE ON DATABASE <database_name>
  TO ROLE SAMOOHA_APP_ROLE
  WITH GRANT OPTION;
Copy

Grant reference usage once per clean room

If you prefer to grant reference usage to a database per clean room rather than to all clean rooms in the account, run the following SQL command. Replace the database name and clean room ID placeholders with the appropriate values:

GRANT REFERENCE_USAGE ON DATABASE <database_name>
  TO SHARE IN APPLICATION PACKAGE SAMOOHA_CLEANROOM_<clean_room_ID>;
Copy

取消注册数据对象

表链接到 Clean Room 后就无法移除。但是,您可以取消注册该账户中的对象,这将移除该账户中所有 Clean Room 的访问权限。

如果您想从 Clean Room 或账户中移除数据,不要 简单地删除底层对象;这将导致 Clean Room 失效。相反,使用以下方法之一取消注册该对象。

当您从账户中取消注册对象时,还应更新您创建的所有使用此数据的 Clean Room。

任何协作者的查询如果依赖于已删除的数据,下次运行时将会失败。

要取消注册账户中的对象,请执行以下操作:

  1. Sign in to the Clean rooms UI as an account administrator and then take one of the following steps:

    • 如果使用托管账户,请选择 Admin > My Account

    • 如果使用 Snowflake 账户,请选择 Admin > Snowflake Admin,并以具有 ACCOUNTADMIN 角色的用户身份登录 Snowflake。

  2. 选择 Admin > Snowflake Admin

  3. 选择 Log in to Snowflake,并以具有 ACCOUNTADMIN 角色的用户进行身份验证。

  4. 要在账户中启用外部表或 Iceberg 表,请启用 External & Iceberg Tables 切换开关。

  5. Access management for Snowflake objects 部分中,选择 Edit,然后选择数据库、架构或对象,使该账户的用户无法使用其数据。

  6. 选择 Save

  7. 更新您根据此数据创建的所有 Clean Room。

启用外部表和 Apache Iceberg™ 表

要允许外部表和 Iceberg 表链接到 Clean Room,必须首先配置账户,以允许使用外部表和 Iceberg 表。启用外部表和 Iceberg 表后,即可像处理其他表一样注册、链接和使用这些表。

The process for enabling external and Iceberg tables varies, depending on whether you are managing the clean room using the Clean rooms UI or the Clean rooms API.

外部表和 Iceberg 表要求

  • 提供商和使用者账户都必须启用外部表和 Iceberg 表,这样才能允许完全使用链接外部表或 Iceberg 表的 Clean Room。

  • 在与托管账户共享 Clean Room 时,提供商必须始终启用外部表和 Iceberg 表。 这是因为托管账户始终使用外部表。

  • 如果提供商和使用者分处不同的区域, 则只有使用者可以将外部表或 Iceberg 表链接到 Clean Room。

The Clean rooms UI controls external and Iceberg tables at the account level.

警告

如果使用者账户未启用此功能,使用者将被阻止加入任何链接到外部表或 Iceberg 表的 Clean Room,或被阻止编辑(但仍可运行)任何已联接的、链接到这两种表之一的 Clean Room。

提供商和使用者账户中的 DCR 管理员必须执行以下步骤:

  1. Sign in to the Clean rooms UI as an account administrator and then take one of the following steps:

    • 如果使用托管账户,请选择 Admin > My Account

    • 如果使用 Snowflake 账户,请选择 Admin > Snowflake Admin,并以具有 ACCOUNTADMIN 角色的用户身份登录 Snowflake。

  2. 启用 External & Iceberg Tables 切换开关。这样可以在 UI 和 API 创建的 Clean Room 中启用该功能。

  3. 现在,可在管理员的 Access management for Snowflake objects 面板中选择外部表和 Iceberg 表,从而使其可用于 Clean Room,就像其他任何对象一样。

语言: 中文