CREATE CATALOG

重要

Unity Catalog 目前为公共预览版。 要使用该预览版,请联系 Azure Databricks 代表。

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

起始版本:Databricks Runtime 10.3

语法

CREATE CATALOG [ IF NOT EXISTS ] catalog_name
    [ COMMENT comment ]

参数

  • catalog_name

    要创建的目录的名称。

  • IF NOT EXISTS

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

  • comment

    可选的 STRING 文本。 目录的描述。

示例

-- Create catalog `customer_cat`. This throws exception if catalog with name customer_cat
-- already exists.
> CREATE CATALOG customer_cat;

-- Create catalog `customer_cat` only if catalog with same name doesn't exist.
> CREATE CATALOG IF NOT EXISTS customer_cat;

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