Disabling or Restoring the Lifecycle of a Table
Function
This section describes how to disable or restore the lifecycle of a specified table or partition.
- If the lifecycle function has been enabled for a table or partitioned table, the system allows you to disable or restore the lifecycle of the table by changing the value of dli.table.lifecycle.status.
- If the lifecycle function is not enabled for a table or partitioned table, the system will add the dli.table.lifecycle.status property to allow you to disable or restore the lifecycle function of the table.
Notes and Constraints
- The table lifecycle function is currently in the open beta test (OBT) phase. If necessary, contact customer service to whitelist it.
- The table lifecycle function currently only supports creating tables and versioning tables using Hive and Datasource syntax.
- The unit of the lifecycle is in days. The value should be a positive integer.
- The lifecycle can be set only at the table level. The lifecycle specified for a partitioned table applies to all partitions of the table.
Syntax
- This syntax can be used to disable or restore the lifecycle of a table at the table level.
1
ALTER TABLE table_name SET TBLPROPERTIES("dli.table.lifecycle.status"={enable|disable});
- This syntax can be used to disable or restore the lifecycle of a specified table at the table or partition table level.
1
ALTER TABLE table_name [pt_spec] LIFECYCLE {enable|disable};
Keywords
TBLPROPERTIES: Table properties, which can be used to extend the lifecycle of a table.
Parameters
Parameter |
Mandatory |
Description |
---|---|---|
table_name |
Yes |
Name of the table whose lifecycle is to be disabled or restored |
pt_spec |
No |
Partition information of the table whose lifecycle is to be disabled or restored. The format is partition_col1=col1_value1, partition_col2=col2_value1.... For a table with multi-level partitions, all partition values must be specified. |
enable |
No |
Restores the lifecycle function of a table or a specified partition.
|
disable |
No |
Disables the lifecycle function of a table or a specified partition.
|
Example
- Example 1: Disable the lifecycle function of the test_lifecycle table.
1
alter table test_lifecycle SET TBLPROPERTIES("dli.table.lifecycle.status"='disable');
- Example 2: Disable the lifecycle function for the partition whose time is 20230520 in the test_lifecycle table.
1
alter table test_lifecycle partition (dt='20230520') LIFECYCLE 'disable';
- After the lifecycle function of a partitioned table is disabled, the lifecycle function of all partitions within the table will also be disabled.
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