Specifying the Lifecycle of a Table When Creating the Table

Function

DLI provides table lifecycle management to allow you to specify the lifecycle of a table when creating the table. DLI determines whether to reclaim a table based on the table's last modification time and its lifecycle. By setting the lifecycle of a table, you can better manage a large number of tables, automatically delete data tables that are no longer used for a long time, and simplify the process of reclaiming data tables. Additionally, data restoration settings are supported to prevent data loss caused by misoperations.

Table Reclamation Rules

Constraints and Limitations

Syntax

Keywords

Parameters

Table 1 Parameters

Parameter

Mandatory

Description

table_name

Yes

Name of the table whose lifecycle needs to be set

dli.lifecycle.days

Yes

Lifecycle duration. The value must be a positive integer, in days.

external.table.purge

No

This parameter is available only for OBS tables.

Whether to clear data in the path when deleting a table or partition. The data is not cleared by default.

When this parameter is set to true:

  • After a file is deleted from a non-partitioned OBS table, the table directory is also deleted.
  • The custom partition data in the partitioned OBS table is also deleted.

dli.lifecycle.trash.dir

No

This parameter is available only for OBS tables.

When external.table.purge is set to true, the backup directory will be deleted. By default, backup data is deleted seven days later.

Example