CREATE RECIPIENT

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 10.4 LTS and above check marked yes Unity Catalog only

Creates a Delta Sharing recipient with the specified name and generates an activation link. If a recipient with the same name already exists, an exception is thrown.

To create and manage a recipient you must be a metastore administrator or have the CREATE RECIPIENT privilege on the metastore.

Use DESCRIBE RECIPIENT to retrieve the activation link.

Syntax

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

Parameters

  • IF NOT EXISTS

    Creates a recipient with the given name if it does not exist. If a recipient with the same name already exists, nothing will happen.

  • recipient_name

    The name of the recipient to be created.

  • sharing_identifier

    An optional global unique identifier of a Unity Catalog metastore owned by the Delta Sharing recipient with whom you like to share data. This is the output of the current_metastore function executed by the Delta Sharing recipient.

    Using this option sets the authentication type to DATABRICKS, otherwise the authentication type is set to TOKEN, requiring you to send an activation link to the recipient for them to access shared date.

  • comment

    An optional STRING literal. The description for the recipient.

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

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 12.2 LTS and above.

    Sets a custom property on a recipient.

    Recipient properties can be used to share different table partitions with different recipients using the same share object. SeeManage recipient properties and Use recipient properties to do partition filtering.

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

Examples

-- 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