CREATE CATALOG
Applies to: Databricks SQL
Databricks Runtime 10.3 and above
Unity Catalog only
Creates a catalog with the specified name. If a catalog with the same name already exists, an exception is thrown.
Syntax
CREATE CATALOG [ IF NOT EXISTS ] catalog_name
[ USING SHARE provider_name . share_name ]
[ MANAGED LOCATION 'location_path' ]
[ COMMENT comment ]
Parameters
IF NOT EXISTS
Creates a catalog with the given name if it does not exist. If a catalog with the same name already exists, nothing will happen.
-
The name of the catalog to be created.
USING SHARE provider_name
.
share_nameOptionally specifies that the catalog is based on a Delta Sharing share.
-
The name of the Delta Sharing provider who supplied the share.
-
The name of the share provided by provider_name.
-
MANAGED LOCATION
'location_path'
Optionally specifies the path to a managed storage location for the catalog that is different than the metastore’s root storage location. This path must be defined in an external location configuration, and you must have the
CREATE MANAGED STORAGE
privilege on the external location configuration. You can use the path that is defined in the external location configuration or a subpath (in other words,'s3://depts/finance'
or's3://depts/finance/product'
). Supported in Databricks SQL or on clusters running Databricks Runtime 11.3 and above.See also Managed tables and Configure a storage bucket and IAM role in AWS.
comment
An optional
STRING
literal. The description for the catalog.
Examples
-- 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';
-- Create a catalog from a Delta Sharing share.
> CREATE CATALOG customer_cat USING SHARE cdc.vaccinedata;
-- Create a catalog with a different managed storage location than the metastore's.
> CREATE CATALOG customer_cat MANAGED LOCATION 's3://depts/finance';