SHALLOW CLONE
Function
This command creates a shallow copy of an existing Delta table in a specific version. The cloned information includes the schema, partition information, and data file paths.
Any changes made to the cloned table will only affect the clone itself and not the source table, as long as they do not touch the source data. Note that the cloned table may still point to the data files of the source table, which may cause issues if the source table undergoes a vacuum operation and the files are not found for the clone.
Syntax
CREATE TABLE [target_db.]target_table
SHALLOW CLONE [source_db.]source_table|DELTA.`obs://bucket_name/tbl_path`
location 'obs://bucket_name/tbl_path'
Parameter Description
Parameter |
Description |
---|---|
target_db |
Name of the target database, consisting of letters, numbers, and underscores (_) |
target_table |
Name of the target table, consisting of letters, numbers, and underscores (_) |
source_db |
Name of the source database, consisting of letters, numbers, and underscores (_) |
source_table |
Name of the source table, consisting of letters, numbers, and underscores (_) |
bucket_name |
OBS bucket name |
tbl_path |
Storage location of the Delta table in the OBS bucket |
constraint_name |
Constraint name |
boolExpression |
Constraint expression |
Required Permissions
- SQL permissions
Permission Description |
---|
CREATE_TABLE permission on the target database |
SELECT permission on the source table |
- Fine-grained permissions: dli:database:createTable and dli:table:select
- Metadata services provided by LakeFormation. Refer to the LakeFormation documentation for details on permission configuration.
Example
CREATE OR REPLACE TABLE delta_table1 SHALLOW CLONE delta_table0 LOCATION 'obs://bucket0/db0/delta_table1'; CREATE TABLE delta.`obs://bucket0/db0/delta_table1` SHALLOW CLONE delta_table0 VERSION AS OF 10;
System Response
Displays whether the task is successfully executed in the execution history or job list.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot