ALTER CATALOG

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 10.3 and above check marked yes Unity Catalog only

Transfers the ownership of a catalog to a new principal, applies tags to a catalog, or enables or disables predictive optimization for a catalog.

Syntax

ALTER CATALOG [ catalog_name ]
 { [ SET ] OWNER TO principal
   SET TAGS ( { tag_name = tag_value } [, ...] ) |
   UNSET TAGS ( tag_name [, ...] ) } |
   { ENABLE | DISABLE | INHERIT } PREDICTIVE OPTIMIZATION }

Parameters

  • catalog_name

    The name of the catalog to be altered. If you provide no name the default is hive_metastore.

  • [ SET ] OWNER TO principal

    Transfers ownership of the catalog to principal.

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 11.2 and above

    SET is allowed as an optional keyword.

  • SET TAGS ( { tag_name = tag_value } [, …] )

    Apply tags to the catalog. You need to have use_catalog permission to apply a tag to a catalog. See USE CATALOG.

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 13.3 LTS and above

  • UNSET TAGS ( tag_name [, …] )

    Remove tags from the catalog. You need to have use_catalog permission to apply a tag to a catalog.

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 13.3 LTS and above

  • tag_name

    A literal STRING. The tag_name must be unique within the catalog.

  • tag_value

    A literal STRING.

  • { ENABLE | DISABLE | INHERIT } PREDICTIVE OPTIMIZATION

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 12.2 and above

    Preview

    This feature is in Public Preview.

    Alters the catalog to the desired predictive optimization setting. By default, when catalogs are created, the behavior is to INHERIT from the account. By default, new objects created in the catalog will inherit the setting from the catalog.

    If the catalog is altered, the behavior will cascade to all schemas and their objects, which inherit predictive optimization. Objects in schemas that do not inherit predictive optimization or objects that explicitly ENABLE or DISABLE predictive optimization are not affected by the catalog setting.

    To set predictive optimization for a catalog, the user must have CREATE permission on the catalog.

    Only non-Delta Sharing, managed catalogs in Unity Catalog are eligible for predictive optimization.

Examples

-- Creates a catalog named `some_cat`.
> CREATE CATALOG some_cat;

-- Transfer ownership of the catalog to another user
> ALTER CATALOG some_cat OWNER TO `alf@melmak.et`;

-- Applies three tags to the catalog named `test`.
> ALTER CATALOG test SET TAGS ('tag1' = 'val1', 'tag2' = 'val2', 'tag3' = 'val3');

-- Removes three tags from the catalog named `test`.
> ALTER CATALOG test UNSET TAGS ('tag1', 'tag2', 'tag3');
–– Enables predictive optimization for catalog main
> ALTER CATALOG main ENABLE PREDICTIVE OPTIMIZATION;
> DESCRIBE CATALOG EXTENDED main;
  Key                        value
  ------------------------    ---------
  < other rows of describe extended >
  Predictive Optimization    ENABLE

-- Sets catalog main to inherit setting from parent object (metastore)
> ALTER CATALOG main INHERIT PREDICTIVE OPTIMIZATION;
> DESCRIBE CATALOG EXTENDED main;
  Key                         value
  ------------------------    ----------------------------------------
  < other rows of describe extended >
  Predictive Optimization     ENABLE (inherited from METASTORE metastore_name)