purge

Purges table data for a specified date range at the time the overall query starts. Typically used when you want to purge existing data and load new data each time a query runs.

Command properties

ItemDescription
Command typeProcessing query
Required permissionAdministrator
License usageN/A
Parallel executionNot supported
Distributed executionNot supported

Syntax

purge from=STR to=STR TABLE[, ...]

Options

from=STR
Start date for the purge range, in yyyyMMdd format.
to=STR
End date for the purge range, in yyyyMMdd format.
TABLE[, ...]
Names of the tables to purge, separated by commas. Wildcards (*) are supported.

Error codes

Parse errors
Error codeMessageDescription
11400The procedure cannot be found.The user does not have administrator permission
11401Incomplete expression.The command string ends with a comma (,)
11402Enter the start date.The from option is not specified
11403Enter the end date.The to option is not specified
11404Invalid date expression: [msg].The value of the from or to option is not in yyyyMMdd format or is an invalid date
11405The [table] table does not exist.The specified table does not exist
11406Invalid date range.The from date is later than the to date
Runtime errors

N/A

Description

The purge command purges table data for the specified date range at query start (onStart). The data purge is performed once at query start, independently of record processing in the query pipeline.

Because purge is a processing query, it requires a driver query preceding it to generate data. It passes input records to the next command unchanged without modifying them.

Wildcards are supported in table names, and multiple tables can be specified separated by commas. If no local table matches a wildcard pattern and the pattern is not optional (no ? suffix), a parse error occurs.

Examples

  1. Purging table data and loading new data

    table duration=1h raw_logs
    | purge from=20260301 to=20260317 summary_table
    | import summary_table
    

    Purges data from March 1 to March 17, 2026 in summary_table, then loads data retrieved from the raw_logs table into summary_table.

  2. Purging data from multiple tables

    json "{}" | purge from=20250101 to=20251231 web_logs,app_logs
    

    Purges all data from 2025 in the web_logs and app_logs tables.

  3. Purging data using a wildcard

    json "{}" | purge from=20250101 to=20250131 tmp_*
    

    Purges January 2025 data from all tables whose names start with tmp_.