DataZen Documentation
DataZen User Guide

DELETE SNAPSHOT

Overview

Deletes one or more previously saved snapshots by exact name or name pattern (for example sales*). Use this to clean up permanent snapshots that are no longer needed. Temporary snapshots saved with AUTO_DELETE are removed automatically at pipeline completion and usually do not need an explicit delete.

  • BEFORE — deletes matching snapshots whose last modified time is older than the date/time or epoch value provided.
  • INCLUSIVE — when specified with BEFORE, includes snapshots whose last modified time equals the BEFORE value.

Related commands: SAVE SNAPSHOT, LIST SNAPSHOT, LOAD SNAPSHOT. See also Snapshots in the Development Guide.

Syntax

Deletes one or more snapshots given its name or a name pattern.

DELETE SNAPSHOT '...'
    { BEFORE '...' 
      { INCLUSIVE }
    }
;

BEFORE

A date/time or epoch value indicating the last modified date to use

INCLUSIVE

If specified, the BEFORE date will be included for deletion

Example 1

-- Deletes a previously saved snapshot given its name
DELETE SNAPSHOT 'customers';


Example 2

-- Deletes a previously saved snapshot given its name that 
-- are strictly older than 30 days 

DELETE SNAPSHOT 'sales*' BEFORE '#dateadd(#utcnow(), -30d)';