Applies to: Databricks SQL Databricks Runtime
Clones a source Delta table to a target destination at a specific version. A clone can be either deep or shallow: deep clones copy over the data from the source and shallow clones do not. You can also clone source Parquet and Iceberg tables. See Incrementally clone Parquet and Iceberg tables to Delta Lake.
In Databricks SQL and Databricks Runtime 13.1 and above, you can use shallow clone with Unity Catalog managed tables. In Databricks Runtime 13.0 and below, there is no support for shallow clones in Unity Catalog. See Shallow clone for Unity Catalog managed tables.
There are important differences between shallow and deep clones that can determine how best to use them. See Clone a table on Databricks.
CREATE TABLE [IF NOT EXISTS] table_name [SHALLOW | DEEP] CLONE source_table_name [TBLPROPERTIES clause] [LOCATION path]
[CREATE OR] REPLACE TABLE table_name [SHALLOW | DEEP] CLONE source_table_name [TBLPROPERTIES clause] [LOCATION path]
IF NOT EXISTS
If specified, the statement is ignored if
[CREATE OR] REPLACE
CREATE ORis specified the table is replaced if it exists and newly created if it does not. Without
The name of the Delta Lake table to be created. The name must not include a temporal specification. If the name is not qualified the table is created in the current schema.
table_namemust not exist already unless
IF NOT EXISTShas been specified.
SHALLOW CLONE or DEEP CLONE
If you specify
SHALLOW CLONEDatabricks will make a copy of the source table’s definition, but refer to the source table’s files. When you specify
DEEP CLONE(default) Databricks will make a complete, independent copy of the source table.
The name of the Delta Lake table to be cloned. The name may include a temporal specification.
Optionally sets one or more user-defined properties.
Optionally creates an external table, with the provided location as the path where the data is stored. If
table_nameitself a path instead of a table identifier, the operation will fail.
pathmust be a STRING literal.
You can use
CREATE TABLE CLONE for complex operations like data migration, data archiving, machine learning flow reproduction, short-term experiments, and data sharing. See Clone a table on Databricks.