Guides
Reload a window
Replace a window of recent and future rows on every run, such as 7 days ago to 7 days ahead, with delete_insert, lookback, lookahead and lookback_from.
Some tables keep changing after their rows are written and hold future dates, such as deliveries scheduled ahead or bookings. Replacing a fixed window around today on every run keeps them right without reloading the whole table. This guide reloads from 7 days ago to 7 days ahead.
Set the window
Section titled “Set the window”[sources.app.tables."public.deliveries"]description = "Deliveries, one row each, scheduled up to two weeks ahead."write_strategy = "delete_insert"cursor_column = "delivery_date"lookback = "7d"lookahead = "7d"lookback_from = "now"| Setting | Here |
|---|---|
write_strategy = "delete_insert" |
Deletes the window’s rows, then inserts what it read. Needs no key. |
cursor_column |
The date or timestamp the window is on. |
lookback |
How far back the window starts. |
lookback_from = "now" |
Count lookback from the time of the run, not the destination’s maximum. |
lookahead |
Read only values before now plus this; a date cursor reads up to and including today plus that many days. |
plan shows the window on the table’s reads line. On 14 November 2026:
$ sqlload plan -v…Loads (1) sqlload load└── raw.app__deliveries delete_insert (cursor: delivery_date) ├── source postgres app public.deliveries ├── route read as Arrow -> DuckDB takes Arrow ├── reads delivery_date from 2026-11-07 (now minus lookback 7days), below 2026-11-22 (now plus lookahead 7days) └── commits once, at the end of the read (delivery_date isn't read in order)…Every run replaces 7 to 21 November. A delivery deleted at the source while its date is in the window is deleted from the destination too.
How the window is counted
Section titled “How the window is counted”-
Days are counted in UTC; a date cursor moves by whole days. A timestamp cursor reads from exactly now minus
lookbackto now pluslookahead. -
The first run reads the same window, so older rows never load. To fill the table, run
--reloadonce (below), or backfill a range. -
--start-cursorand--end-cursorreplace the window for one run:$ sqlload plan --start-cursor 2026-10-01 --end-cursor 2026-11-01…├── reads delivery_date from 2026-10-01 (--start-cursor), below 2026-11-01 (--end-cursor)… -
--reloadrebuilds the table fromcursor_start, or from the first row, up to the lookahead:$ sqlload plan --reload…├── reads delivery_date: reload, everything, below 2026-11-22 (now plus lookahead 7days)… -
--reload --start-cursorrebuilds from that point and drops older rows; see Reloading.
Without lookback_from
Section titled “Without lookback_from”Without it, lookback counts back from the destination’s maximum, so each run re-reads a window
behind the newest row, here 2 hours, and everything after:
[sources.app.tables."public.page_views"]description = "Page views, one row per view."write_strategy = "delete_insert"cursor_column = "viewed_at"lookback = "2h"That suits late rows, but not future dates, whose maximum is already ahead of today. lookahead
works with either.
Limits
Section titled “Limits”lookaheadandlookback_from = "now"need a date or timestamp cursor.lookback_from = "now"needs a durationlookback, such as"1d".appendtakes nolookback, which would insert the window again; usedelete_insert, ormergewhen the table has a key.- A files target takes neither
lookaheadnorlookback_from = "now": its window follows its newest partition. - Python tables take
lookback, but notlookaheadorlookback_from.
See Cursors and delete_insert.