CREATE SHARE (Databricks SQL)

重要

Delta Sharing 目前为公共预览版。 要使用预览版,必须在 Azure Databricks 帐户控制台中启用外部数据共享功能组。 请参阅为帐户启用外部数据共享功能组

Delta Sharing 受适用条款约束。 启用外部数据共享功能组即表示接受这些条款。

创建具有指定名称的共享。 如果已存在同名共享,则会引发异常。

要创建和管理共享,你必须是元存储管理员,并且必须使用 Unity Catalog 元存储配置 Databricks SQL。

若要向共享添加内容,请使用 ALTER SHARE

语法

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

参数

  • share_name

    要创建的共享名称。

  • IF NOT EXISTS

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

  • comment

    可选的 STRING 文本。 共享的说明。

示例

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