.alter table policy auto_delete command

Applies to: ✅ Azure Data Explorer

Alters the auto delete policy that's applied to a table. For more information, see auto delete policy.

Permissions

You must have at least Table Admin permissions to run this command.

Syntax

.alter table TableName policy auto_delete SerializedPolicyObject

Learn more about syntax conventions.

Parameters

Name Type Required Description
TableName string ✔️ Name of the table.
SerializedPolicyObject string ✔️ JSON representation of the policy.

Returns

Name Type Description
PolicyName string Name of the policy. For table auto delete policy this value is AutoDeletePolicy.
EntityName string Name of the entity for which the policy is set. For table auto delete policy this value is [databaseName].[tableName], where databaseName corresponds to the name of the database in which in the table exists, and tableName to the name of the table itself.
Policy string JSON representation of the policy object.
ChildEntities string Child entities for which this policy is set. For table auto delete policy this value is an empty string.
EntityType string Type of entity for which this policy is set. For table auto delete policy this value is Table.

Examples

Set expiry date of a table

Set expiry of table T to 2023-06-01. Table will be deleted even if there are records in it (noted by DeleteIfNotEmpty):

.alter table T policy auto_delete @'{ "ExpiryDate" : "2023-06-01", "DeleteIfNotEmpty": true }'

Output

PolicyName EntityName Policy ChildEntities EntityType
AutoDeletePolicy [database].[T] { "ExpiryDate": "2023-06-01T00:00:00" "DeleteIfNotEmpty": true } Table