CREATE SHARE (Databricks SQL)

Preview

Delta Sharing is in Public Preview. To participate in the preview, you must enable the External Data Sharing feature group in the Databricks Account Console. See Enable the External Data Sharing feature group for your account.

Delta Sharing is subject to applicable terms. Enabling the External Data Sharing feature group represents acceptance of those terms.

Creates a share with the specified name. If a share with the same name already exists, an exception is thrown.

To create and manage a share you must be a metastore administrator and Databricks SQL must be configured with the Unity Catalog metastore.

To add content to the share use ALTER SHARE

Syntax

CREATE SHARE [ IF NOT EXISTS ] share_name
    [ COMMENT comment ]

Parameters

  • share_name

    The name of the share to be created.

  • IF NOT EXISTS

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

  • comment

    An optional STRING literal. The description for the share.

Examples

-- Create share `customer_share`. This throws exception if a share with name customer_share
-- already exists.
> CREATE SHARE customer_share;

-- Create share `customer_share` only if share with same name doesn't exist.
> CREATE SHARE IF NOT EXISTS customer_share;

-- Create share `customer_share` only if share with same name doesn't exist, with a comment.
> CREATE SHARE IF NOT EXISTS customer_share COMMENT 'This is customer share';