Specify a managed storage location in Unity Catalog

A managed storage location specifies a location in cloud object storage for storing data for managed tables and managed volumes.

You can associate a managed storage location with a metastore, catalog, or schema. Managed storage locations at lower levels in the hierarchy override storage locations defined at higher levels when managed tables or managed volumes are created.

When an account admin creates a metastore, they can associate a storage location in an S3 bucket in your AWS account to use as a managed storage location. Managed storage locations at the catalog and schema levels are optional, but Databricks recommends assigning managed storage locations at the catalog level for logical data isolation. See Data governance and data isolation building blocks.

Important

If your workspace was enabled for Unity Catalog automatically, the Unity Catalog metastore was created without a metastore-level managed storage location. You should assign a managed storage location at the catalog or schema level. See Automatic enablement of Unity Catalog and Data governance and data isolation building blocks.

What is a managed storage location?

Managed storage locations have the following properties:

  • Managed tables and managed volumes store data and metadata files in managed storage locations.

  • Managed storage locations cannot overlap with external tables or external volumes.

The following table describes how a managed storage location is declared and associated with Unity Catalog objects:

Associated Unity Catalog object

How to set

Relation to external locations

Metastore

Configured by account admin during metastore creation.

Cannot overlap an external location.

Catalog

Specified during catalog creation using the MANAGED LOCATION keyword.

Must be contained within an external location.

Schema

Specified during schema creation using the MANAGED LOCATION keyword.

Must be contained within an external location.

The managed storage location that stores data and metadata for managed tables and managed volumes uses the following rules:

  • If the containing schema has a managed location, the data is stored in the schema managed location.

  • If the containing schema does not have a managed location but the catalog has a managed location, the data is stored in the catalog managed location.

  • If neither the containing schema nor the containing catalog have a managed location, data is stored in the metastore managed location.

Unity Catalog prevents overlap of location governance. See How do paths work for data managed by Unity Catalog?.

Managed storage location, storage root, and storage location

When you specify a MANAGED LOCATION for a catalog or schema, the provided location is tracked as the Storage Root in Unity Catalog. To ensure that all managed entities have a unique location, Unity Catalog adds hashed subdirectories to the specified location, using the following format:

Object

Path

Schema

<storage-root>/__unitystorage/schemas/00000000-0000-0000-0000-000000000000

Catalog

<storage-root>/__unitystorage/catalogs/00000000-0000-0000-0000-000000000000

The fully qualified path for the managed storage location is tracked as the Storage Location in Unity Catalog.

You can specify the same managed storage location for multiple schemas and catalogs.

Required privileges

Users who have the CREATE MANAGED STORAGE privilege on an external location can configure managed storage locations during catalog or schema creation.

Managed storage locations set at the metastore level must be configured by account admins during metastore creation.

Set a managed storage location for a catalog

Set a managed storage location for a catalog by using the MANAGED LOCATION keyword during catalog creation, as in the following example:

CREATE CATALOG <catalog-name>
MANAGED LOCATION 's3://<external-location-bucket-path>/<directory>';

Set a managed storage location for a schema

Set a managed storage location for a schema by using the MANAGED LOCATION keyword during schema creation, as in the following example:

CREATE SCHEMA <catalog>.<schema-name>
MANAGED LOCATION 's3://<external-location-bucket-path>/<directory>';

Next steps

Manage storage locations are used for creating managed tables and managed volumes. See Create tables in Unity Catalog and Create and work with volumes.