Shallow clone for Unity Catalog managed tables

Important

In Databricks Runtime 13.1 and above, shallow clone support for Unity Catalog is in Public Preview.

You can use shallow clone to create new Unity Catalog managed tables from existing Unity Catalog managed tables. Shallow clone support for Unity Catalog allows you to create tables with access control privileges independent from their parent tables without needing to copy underlying data files.

For more on Delta clone, see Clone a table on Databricks.

For more on Unity Catalog managed tables, see Managed tables.

Create a shallow clone on Unity Catalog

You can create a shallow clone in Unity Catalog using the same syntax available for shallow clones throughout the product, as shown in the following syntax example:

CREATE TABLE <catalog_name>.<schema_name>.<target_table_name> SHALLOW CLONE <catalog_name>.<schema_name>.<source_table_name>

To create a shallow clone on Unity Catalog, you must have sufficient privileges on both the source and target resources, as detailed in the following table:

Resource

Permissions required

Source table

SELECT

Source schema

USE

Source catalog

USE

Target schema

USE, CREATE TABLE

Target catalog

USE

Like other create table statements, the user who creates a shallow clone is the owner of the target table. The owner of a target cloned table can control the access rights for that table independently of the source table.

Note

The owner of a cloned table might be different than the owner of a source table.

Query or modify a shallow cloned table on Unity Catalog

Important

The instructions in this section describe privileges needed for compute configured with shared access mode. For single user access mode, see Work with shallow cloned tables in single user access mode.

To query a shallow clone on Unity Catalog, you must have sufficient privileges on the table and containing resources, as detailed in the following table:

Resource

Permissions required

Catalog

USE

Schema

USE

Table

SELECT

You must also have MODIFY permissions on the target of the clone operation to complete the following actions:

  • Insert records

  • Delete records

  • Update records

  • MERGE

  • CREATE OR REPLACE TABLE

  • DROP TABLE

Work with shallow cloned tables in single user access mode

When working with Unity Catalog shallow clones in single user access mode, you must have permissions on the resources for the cloned table source as well as the target table.

This means that for simple queries in addition to the required permissions on the target table, you must have USE permissions on the source catalog and schema and SELECT permissions on the source table. For any queries that would update or insert records to the target table, you must also have MODIFY permissions on the source table.

Databricks recommends working with Unity Catalog clones on compute with shared access mode as this allows independent evolution of permissions for Unity Catalog shallow clone targets and their source tables.

Limitations

  • For shallow clones in Unity Catalog, only Unity Catalog managed tables are supported for both the source and target.

  • You cannot share shallow clones using Delta Sharing.

  • You cannot nest shallow clones, meaning you cannot make a shallow clone from a shallow clone.

  • Running VACUUM or dropping the source table breaks the target table for shallow clones.