Strategies
append
Inserts new rows without modifying existing data. Optionally uses a cursor (read from the target table’s highest value) to avoid reprocessing the full source on every run.append_cursor_inclusive is true (the default), the lower bound uses >=, which may duplicate the boundary row but avoids missing late-arriving data with the same cursor value. Set to false for an exclusive (>) lower bound if your cursor values are guaranteed unique.
Append without a cursor is also valid. The model simply inserts all rows from the source query on every run.
delete_insert
Deletes rows in the cursor range, then inserts the new delta. Requires eithercursor or unique_key.
delete_insert removes rows where the cursor column falls within the replay window, then inserts the new delta. With a unique_key only, it deletes matching rows by key before inserting.
merge
Upserts rows using a unique key. Matched rows are updated; unmatched rows are inserted.merge always requires unique_key. The cursor controls which upstream rows are scanned; the unique key determines how they’re matched against the target.
Cursors
Cursors define the incremental replay boundary. SQLBuild queriesMAX(cursor) from the target table and MIN/MAX from upstream inputs to compute the replay window automatically.
| Field | Description |
|---|---|
cursor | Output column used to track incremental position |
cursor_type | timestamp or integer |
cursor_grain | Time grain for timestamp cursors: second, minute, hour, day, month, year |
cursor_start | Lower bound floor; the cursor will never replay before this value |
cursor_inputs | Map of upstream ref/source names to their cursor columns |
cursor_inputs
When a model references multiple upstream inputs,cursor_inputs is required to tell SQLBuild which column on each input carries the cursor:
MIN/MAX across all upstream inputs and determine the replay window.
Lookback
Lookback extends the start of the replay window backwards to re-process recent data. This is useful for handling late-arriving records:lookback 3d, the replay window starts 3 days before the normal cursor position, ensuring that any late-arriving data within that window is picked up.
Microbatch execution
For large incremental ranges, microbatch mode splits the replay window into configurable batches. Each batch is processed serially with its own audit cycle: create delta, run delta audits, apply DML, clean up.Batch size
batch_size controls the window size for each batch. For timestamp cursors, use duration strings like 1d, 6h, 1mo. For integer cursors, use an integer value.
Mixed-grain chains
When a downstream microbatch model depends on an upstream model with a coarser time grain, SQLBuild automatically widens the replay window to the largest participating grain. For example, an hourly model downstream of a daily model will process in day-sized batches to prevent empty windows:Replay on change
When a model’s version identity changes (query, config, upstream cascade, or any other change reason),replay_on_change controls how much data to reprocess:
| Value | Effect |
|---|---|
forward | Run the normal incremental delta from the cursor (default) |
full | Full table rebuild |
bounded-14d | Replay the last 14 days of data |
d (days), h (hours), m (minutes), and s (seconds). For example: bounded-7d, bounded-24h, bounded-30m.
on_schema_change
Controls how schema differences are handled at execution time when the incremental delta has different columns than the target table:| Value | Effect |
|---|---|
append_new_columns | Add new columns to the target table (default) |
sync_all_columns | Add, drop, and alter columns to match the delta |
ignore | Log and continue without schema changes |
fail | Reject the build with an error |

