Truncate Table
Synopsis
Clears every value and presence bit on the named virtual table, keeping it allocated for further $<table>.Field writes.
Schema
- truncate_table:
name: <string>
description: <text>
if: <script>
tag: <string>
disabled: <boolean>
ignore_failure: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
Configuration
| Field | Required | Default | Description |
|---|---|---|---|
name | Y | Table to clear. Must be one of the 12 registered tables (see Create Table), matched case-insensitively. Supports templating, e.g. name: "{{table}}". | |
description | N | Explanatory note. | |
if | N | Condition that must be true for the processor to run. | |
tag | N | Identifier for this processor instance. | |
disabled | N | false | When true, the processor is skipped. |
ignore_failure | N | false | Continue pipeline processing if the processor fails. |
on_failure | N | See Handling Failures. | |
on_success | N | See Handling Success. |
Details
What Gets Cleared
truncate_table resets every column of the named table to absent — clearing both its stored value and its presence bit, not just setting fields back to a zero value like "" or 0. A $<table>.Field == nil check reads true for every column immediately after truncation, exactly as it would on a freshly create_table-d table. The table's backing struct stays allocated, so subsequent $<table>.Field writes need no new create_table call.
If the truncated table is the entry's current output table (selected by Use Table), it stays selected — truncation only clears the struct's contents, it never changes which table use_table picked. The entry keeps marshaling from the same, now empty, table.
Failure Mode
Truncating a table that was never create_table-d on this entry is a no-op, not a failure — the table's member is already absent, so there is nothing to clear. Truncating a name that is not one of the 12 registered tables at all still fails the processor with unknown virtual table: "<name>", same as create_table and drop_table. Add ignore_failure: true to treat that as a soft skip.
Examples
Clearing a Table's Contents
Writing a field, then truncating before selecting the table as output... | |
| |
The Table Stays Allocated for Further Writes
Truncating, then writing a new value into the same table without calling | |
The write succeeds immediately — | |
No-Op on a Table That Was Never Created
Truncating | |
No error is raised — an uncreated table has nothing to clear, and the event passes through unmodified... | |
Failing on an Unknown Table Name
Naming a table that isn't one of the 12 registered schemas... | |
| |