.alter-merge database policy retention command

Applies to: ✅ Azure Data Explorer

Changes the database's retention policy. The retention policy controls the mechanism that automatically removes data from tables or materialized views. It's used to remove data whose relevance is age-based.

Permissions

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

Syntax

.alter-merge database DatabaseName policy retention PolicyObjects

Learn more about syntax conventions.

Parameters

Name Type Required Description
DatabaseName string ✔️ The name of the database for which to alter the retention policy.
ArrayOfPolicyObjects string ✔️ A serialized array of one or more JSON policy objects. For more information, see retention policy.

Example

Sets a retention policy with a 10-day soft-delete period, and disables data recoverability:

.alter-merge database MyDatabase policy retention softdelete = 10d recoverability = disabled