Auto delete policy

An auto delete policy on a table sets an expiry date for the table. The table will be automatically deleted at this expiry time. Unlike the retention policy, which determines when data (extents) is removed from a table, the auto delete policy drops the entire table.

The auto delete policy can be useful for temporary staging tables. Temporary staging tables are used for data preparation, until the data is moved to its permanent location. We recommend explicitly dropping temporary tables when they're no longer needed. Only use the auto delete policy as a backup mechanism if explicit deletion didn't occur.

Tip

If you are working with temporary tables, the following commands may also be useful: create table based-on and replace extents.

The policy object

An auto delete policy includes the following properties:

  • ExpiryDate:
    • The datetime value indicating when the table should be deleted.
    • The deletion time is imprecise, and could occur few hours after the expiry time.
  • DeleteIfNotEmpty:
    • A boolean value indicating whether table should be dropped even if there are still extents in it.
    • Defaults to false.

See also

For more information, see auto delete policy commands.