This feature is in Public Preview.
Available in Databricks Runtime 7.2 and above.
Clone a source Delta table to a target destination at a specific version. A clone can be either deep or shallow referring to whether it copies over the data from the source or not.
There are important differences between shallow and deep clones with respect to dependencies between a clone and the source and other differences. See Clone a Delta table.
CREATE TABLE [IF NOT EXISTS] [db_name.]target_table [SHALLOW | DEEP] CLONE [db_name.]source_table [<time_travel_version>] [LOCATION 'path']
[CREATE OR] REPLACE TABLE [db_name.]target_table [SHALLOW|DEEP] CLONE [db_name.]source_table [<time_travel_version>] [LOCATION 'path']
<time_travel_version> = TIMESTAMP AS OF timestamp_expression | VERSION AS OF version
CREATE TABLE IF NOT EXISTSto avoid creating a table
target_tableif a table already exists. If a table already exists at the target, the clone operation is a no-op.
CREATE OR REPLACEto replace the target of a clone operation if there is an existing table
target_table. This updates the metastore with the new table if table name is used.
DEEPcreates a shallow or deep clone at the target. If neither
DEEPis specified then a deep clone is created by default.
LOCATIONcreates an external table at the target with the provided location as the path where the data will be stored. If the target provided is a path instead of a table name, the operation will fail.
You can use
CLONE for complex operations like data migration, data archiving, machine learning flow reproduction, short-term experiments, data sharing etc. See Clone use cases for a few examples.