CREATE RECIPIENT

适用于:check marked yes Databricks SQL check marked yes Databricks Runtime 10.3 及更高版本 check marked yes 仅 Unity Catalog

创建具有指定名称的 Delta Sharing 收件人并生成激活链接。 如果已存在同名收件人,则会引发异常。

若要创建并管理收件人,你必须是元存储管理员或拥有元存储的 CREATE RECIPIENT 权限。

使用 DESCRIBE RECIPIENT 检索激活链接。

语法

CREATE RECIPIENT [ IF NOT EXISTS ] recipient_name
    [ USING ID sharing_identifier ]
    [ COMMENT comment ]
    [ SET PROPERTIES ( property_key [ = ] property_value [, ...] ) ]

parameters

  • IF NOT EXISTS

    创建具有给定名称的收件人(如果不存在)。 如果已存在同名收件人,则不会执行任何操作。

  • recipient_name

    要创建的收件人的名称。

  • sharing_identifier

    你希望与之共享数据的 Delta Sharing 收件人拥有的 Unity Catalog 元存储的可选全局唯一标识符。 这是 Delta Sharing 收件人执行的 current_metastore 函数的输出。

    使用此选项将身份验证类型设置为 DATABRICKS,否则身份验证类型将设置为 TOKEN,需要向收件人发送激活链接,以便他们访问共享日期。

  • comment

    可选的 STRING 文本。 收件人的说明。

  • SET PROPERTIES ( property_key [ = ] property_value [, ...] )

    适用于:check marked yes Databricks SQL check marked yes Databricks Runtime 12.2 及更高版本。

    设置收件人的自定义属性。

    收件人属性可用来与使用同一共享对象的不同收件人共享不同的表分区。 请参阅管理接收者属性使用接收者属性进行分区筛选

    property_key
    { identifier [. ...] | string_literal }
    
    property_value
    { string_literal }
    

示例

-- A recipient created for Databricks to Databricks sharing
> CREATE RECIPIENT other_databricks_org USING ID 'azure:chinaeast2:f12dcb34-5678-9d4c-1234-c5ac67f8b90a';
> DESCRIBE RECIPIENT other_databricks_org;
 info_name           info_value
 -------------       ----------
 recipient_name      other_databricks_org
 authentication_type DATABRICKS
 owner               alwaysworks@databricks.com
 created_by          alwaysworks@databricks.com
 create_at           2022-01-01T00:00:00.000+0000
 updated_by          alwayswork@databricks.com
 updated_at          2022-01-05T12:00:00.000+0000
 comment
 cloud               azure china
 region              chinaeast2
 metastore_id        f12dcb34-5678-9d4c-1234-c5ac67f8b90a

-- A recipient created for sharing outside of Databricks
> CREATE RECIPIENT other_org;
> DESCRIBE RECIPIENT other_org;
 info_name               info_value
 ----------------------- ----------
 recipient_name          other_org
 authentication_type     TOKEN
 owner                   alwaysworks@databricks.com
 created_by              alwaysworks@databricks.com
 create_at               2022-01-01T00:00:00.000+0000
 updated_by              alwayswork@databricks.com
 updated_at              2022-01-05T12:00:00.000+0000
 comment                 This is Other Corp
 active_token_id         0160c81f-5262-40bb-9b03-3ee12e6d98d7
 active_token_expiration 2023-01-05T12:00:00.000+0000
 activation_link         https://send/this