共用方式為


CREATE SHARE

適用於:標記為是 Databricks SQL 標記為是 Databricks Runtime 10.4 LTS 和更高版本 標記為是 Unity Catalog 仅限

建立具有指定名稱的共用。 如果具有相同名稱的共享已經存在,則會擲回例外狀況。

若要建立共用,您必須是中繼存放區系統管理員,或擁有您要共用數據的 Unity 目錄中繼存放區 CREATE SHARE 許可權。

若要將內容新增至分享,請使用 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';