CLI Reference
load
Load the selected tables of a project, reload them from scratch, follow a Postgres CDC source, and print the result as JSON.
sqlload load [SELECTOR ...] [OPTIONS]sqlload load loads the selected tables, creating any that don’t exist yet. It takes the same
options as plan, and prints the plan’s closing line and any errors and
warnings before a line per table.
Loading
Section titled “Loading”$ sqlload load✓ Plan complete 2 to load (sqlload plan shows the tree)
loaded raw.app__customers 50 rows 0.0sloaded raw.app__orders 1,000 rows 0.0s
✓ Completed 2 loaded, 1,050 rows, 0.1s├── slowest raw.app__orders 0.0s└── peak memory 85.4 MiBEach table prints created, altered, loaded (with its new cursor position, when it keeps one)
or failed. A failed table doesn’t stop the others, and the summary says what a rerun does. The
command exits 1, or 75 when every failure may pass on a rerun; see
Retrying failed runs. On a terminal, a live block shows the
tables running and waiting; see Events for --progress.
Large loads commit along the way, so a rerun carries on from the last commit; see Batches. To read a range, see Backfilling a range.
Stopping at the first failure
Section titled “Stopping at the first failure”--fail-fast starts no other table once one fails. Tables already loading finish and keep what they
committed. The summary lists the rest under not started, and a rerun loads them. The exit code
follows the same rule as without it.
$ sqlload load --fail-fast --concurrency 2…failed raw.shop__returns checks.min_rows failed: 50,000 rows staged, fewer than the 100,000 required; nothing was publishedloaded raw.shop__orders 3,000,000 rows 2.4s
✗ Completed with failures 3 loaded, 1 failed, 1 not started, 3,600,000 rows, 2.5s├── not started raw.shop__shipments (--fail-fast)├── slowest raw.shop__orders 2.4s├── peak memory 314 MiB└── next the 2 unchanged tables load; the 3 that committed carry on from their positions--fail-fast and --memory-per-table don’t combine with --follow.
Reloading
Section titled “Reloading”--reload rebuilds the selected tables from scratch. On a terminal it shows the plan and asks; in
scripts, add --yes.
With --start-cursor and --end-cursor, the rebuilt table holds only the rows in that range, and
plan warns which rows are dropped:
$ sqlload plan -v --reload --start-cursor 100000 --end-cursor 200000 shop__orders… ├── reads order_id from 100000 (--start-cursor), below 200000 (--end-cursor)…Warnings (1)└── shop__orders └── --reload rebuilds the table with only the rows from 100000 (--start-cursor), below 200000 (--end-cursor): rows before 100000 and from 200000 on are droppedWithout --start-cursor, a reload starts from cursor_start, or from the first row. An integer
batch_size on a source that can’t report its maximum needs --end-cursor; see
Batches.
| Table | --reload |
|---|---|
postgres_cdc source |
Refused. Use --resnapshot; see Reloading. |
| Postgres target | Refused. write_strategy = "replace" empties and refills a table in one transaction instead. |
| Files source | Reads every file again, including files after_load = { move_to = ... } moved. See Reloading a files table. |
Peak memory
Section titled “Peak memory”Every load reports the most memory the whole process held at once, ODBC drivers, DuckDB and Python
(under the Python package, the interpreter too) included: peak memory in
the summary, peak_memory_bytes in the JSON report and the run_finished
event. It’s the peak resident set on Linux and macOS, and the peak working set on
Windows.
On Linux, --memory-per-table loads one table at a time, whatever the concurrency, and reports
each table’s peak:
$ sqlload load --memory-per-table✓ Plan complete 2 to load (sqlload plan shows the tree)
loaded raw.app__customers 50 rows 0.0s peak memory 80.7 MiBloaded raw.app__orders 1 row 0.0s peak memory 84.7 MiB…A table’s figure includes what the process already held when it started, so compare the tables of
one run. On other systems, plan, apply and load refuse the flag:
--memory-per-table needs Linux; the run's peak is in every report. See
Finding a source that uses too much memory.
Memory budget
Section titled “Memory budget”A run stays under one memory budget. plan -v shows it first:
$ sqlload plan -v --memory-limit 1200MBMemory 1.1 GiB budget (--memory-limit); 39.8 MiB held before loading; DuckDB 488 MiB (memory_limit 244 MiB, 2 threads); 154 MiB per table, 4 at once…| Part | Meaning |
|---|---|
| Budget | memory_limit or --memory-limit. Default: 80% of the container’s (cgroup memory.max) or Windows job object’s limit, else 50% of the machine’s memory. Where memory can’t be read, the line says no budget and why. |
| Held before loading | What the process holds once connected. It comes off first. |
| DuckDB | DuckDB and MotherDuck targets together take 30% of the rest. Each one’s memory_limit is half its part (DuckDB holds up to about twice it), at least 256MB, with a thread per 128 MiB of it, from two up to the machine’s cores. |
| Per table | The tables share the rest, as many at once as get 64 MiB each, up to concurrency; when fewer fit, the line says so: 1 at once (concurrency 8 doesn't fit). Each source keeps a quarter of its table’s share to read ahead, such as an ODBC fetch buffer. |
memory_limit = "off" (or --memory-limit off) turns the budget off: no watchdog and no pieces,
DuckDB keeps its own memory_limit (80% of the machine’s memory) and threads, and an ODBC fetch
buffer is 512 MiB per table. Only the row-group check in Large rows in DuckDB
stays, against DuckDB’s own memory_limit.
Memory off (memory_limit): no budget or watchdog, and DuckDB keeps its own memory_limit and threadsWhen the budget can’t hold what SQLLoad holds already, or leaves no table 64 MiB, plan fails
naming the budget the run needs, and load stops before it creates or loads anything:
the 600 MiB memory budget leaves the tables 11.7 MiB after DuckDB's 488 MiB, under the 64 MiB one table loads in; raise memory_limit to at least 653MiBLarge rows in DuckDB
Section titled “Large rows in DuckDB”DuckDB keeps values of about 85 KiB and more in memory until a checkpoint, so a large load into
DuckDB or MotherDuck commits in pieces, each holding large values of at most a quarter of DuckDB’s
memory_limit (rows through a staging table, as in merge and delete_insert, count three times).
A reader may see part of an append, merge or delete_insert before its last piece; a first
load, replace and --reload show nothing until the new table is swapped in. A delete_insert
cuts only between values of its replace_key, or of its cursor.
If an append stops partway, the next load of that table removes that load’s rows and warns. Don’t
run two loads of the same table at once.
$ sqlload loadWarnings (1)└── raw.attachments: removed the rows of load 5a401302-…, which stopped before its last commit, so this load reads from before it…Rows that can’t be cut small enough fail only their table, while the others load. Raise
memory_limit to what the message names:
-
One
replace_keyvalue, cursor value or partition holds more than a piece:failed raw.attachments attachments: the rows of one k value hold 300 MiB of values over 85 KiB, which a delete_insert replaces in one commit, past the 61 MiB of them DuckDB's 244 MiB memory_limit commits at once (through a staging table, they count three times); raise memory_limit to at least 23.5GiB -
The table’s open row group (the rows past its last full 122,880) holds more large values than DuckDB rewrites at a checkpoint. Not on MotherDuck:
failed raw.documents documents: its last row group would hold 366 MiB of strings, 366 MiB of them values over 85 KiB from this load (rows of about 1 MiB each), more than DuckDB rewrites at a checkpoint within its 244 MiB memory_limit; raise memory_limit to at least 2GiB (a row group fills at 122,880 rows, and rows this wide need a memory_limit of at least 640.1GiB by then)
Unnested child tables, Postgres CDC changes, the key scan of --sync-deletes, a merge with
on_duplicate_keys = "fail" and a table with checks that isn’t rebuilt
always commit whole. When one commit is too large, they fail the same way and write nothing of it.
A CDC table then stops at that commit until memory_limit is raised, and its replication slot keeps
the source’s write-ahead log meanwhile.
The watchdog
Section titled “The watchdog”While a run loads, SQLLoad reads the memory of the process, and of a MotherDuck target’s bridge process, every 10 ms:
| Share of the budget | What happens |
|---|---|
| 80% | No table starts until it falls, and pieces are cut four times smaller. |
| 90% | The table holding the most large values in memory stops: its running DuckDB statement rolls back, and it fails while the others carry on. A table holding none isn’t stopped. |
| 95% | When no table holds large values to stop, or the one stopped at 90% didn’t bring memory under 90% within half a second, the whole run stops. |
failed raw.attachments raw.attachments stopped: the load held 1 GiB of its 1.1 GiB memory budget (90%); from 90% the table holding the most large values in memory stops, here this one with 39 MiB; raise memory_limit, or lower batch_sizeWhen the run stops, running DuckDB and MotherDuck statements roll back, the running tables fail and
the others don’t start; what committed stays. The summary, --json report and run_finished event
are still written, and the run exits 1 with retryable: false.
failed raw.events stopped: the run held 3.9 GiB of its 4 GiB memory budget (97%), and from 95% it stops as no table held large values to stop; raise memory_limit, or lower concurrencyMemory that grows past the operating system’s or a service manager’s limit within one 10 ms reading is only caught by that limit.
Following a Postgres CDC source
Section titled “Following a Postgres CDC source”sqlload load SOURCE --follow keeps streaming one postgres_cdc source after it catches up,
writing a batch every batch_interval, until --max-duration passes or it gets Ctrl-C or SIGTERM.
A second Ctrl-C or SIGTERM stops it at once, with exit code 130. See
Keep streaming.
sqlload load app --follow --max-duration 10mIt prints what load does, plus a written line for each table in each batch, with its rows and
how far it is behind the server.
Results as JSON
Section titled “Results as JSON”apply --json and load --json print one JSON document on standard output when they finish. Logs
stay on standard error, and the exit code is unchanged.
$ sqlload load --json{ "schema_version": 1, "command": "load", "ok": false, "retryable": true, "started_at": "2026-11-15T02:24:02.691Z", "finished_at": "2026-11-15T02:24:04.729Z", "duration_seconds": 2.039, "summary": { "created": 1, "altered": 0, "recreated": 0, "loaded": 1, "failed": 1, "skipped": 0, "rows": 1200, "peak_memory_bytes": 101089280 }, "plan": { "ok": true, "summary": "2 selected, 2 objects to create, 2 to load", … }, "objects": [ { "action": "created", "name": "raw.shop__orders", "detail": "4 columns" } ], "tables": [ { "table": "raw.shop__orders", "source": "shop", "target": "dev", "write_strategy": "replace", "status": "loaded", "rows": 1200, "duration_seconds": 0.043, "note": null, "error": null, "retryable": false }, { "table": "raw.shop__refunds", "source": "shop", "target": "dev", "write_strategy": "replace", "status": "failed", "rows": null, "duration_seconds": 1.999, "note": null, "error": "GET http://api.example.com/v1/refunds?page=3: HTTP 503: unavailable (after 4 attempts)", "retryable": true } ]}| Field | Meaning |
|---|---|
schema_version |
1. New fields can appear without a change; it changes only when a field changes meaning or goes away. |
command |
apply or load. |
started_at, finished_at, duration_seconds |
RFC 3339 UTC timestamps, and the seconds between. |
ok |
true exactly when the exit code is 0. |
retryable |
true exactly when the exit code is 75. See Retrying failed runs. |
summary |
Objects created, altered (each table once) and recreated; tables loaded, failed and skipped; rows loaded; and peak_memory_bytes, the run’s peak memory. |
plan |
The plan --json document, with its own ok and retryable. Tables a plan error left out are in errors, and tables with nothing to load in skipped. phases times each connection and discovery (see Connecting and discovering); memory is the memory budget line. |
objects |
One entry per change to a table or stage: action (created, altered or recreated), name and detail. A table that gains two columns has two altered entries. |
tables |
One entry per table loaded, below. Empty for apply. |
tables field |
Meaning |
|---|---|
table, source, target, write_strategy |
The table. The last three are null only for a load --follow that failed before any table. |
status |
loaded, failed, or skipped for a table not started: by --fail-fast (error names the table that stopped the run, retryable is true) or by the watchdog’s run stop (retryable is false). |
rows, duration_seconds |
Rows loaded, and seconds taken. |
note |
The cursor window it read, or that its table waits for first data. |
error, retryable |
Why it failed, and whether a rerun may pass. |
warnings |
One line per warning, such as rows outside a cursor window. |
peak_memory_bytes |
Under --memory-per-table: the most the process held while it loaded. |
after_load |
A files source with after_load: action (delete or move), status (done, or failed when any file stayed), files handled, and failed, each file left with its error. |
replaced_keys |
A delete_insert with a replace_key: its columns, the values its commits replaced (sorted, each as its columns’ text joined by , , NULL for a NULL, at most 1,000) and truncated, true when there were more. |
transforms |
A table with a transform: for each file or range, its file, the milliseconds the function took, the rows it was given and dicts, whether it returned dicts. |
names |
A line per column rename named or numbering numbered, as plan shows them, such as "Qty (column 4) -> qty_1 (numbered)". |
When the run can’t start (the configuration doesn’t parse, a connection fails), standard output
holds one error document instead, as plan --json does:
{"error": {"code": "config", "message": "…", "help": "…", "retryable": false}}. code is config
for the configuration, else the command’s name. retryable is true, and the exit code 75, when a
rerun may fix it, such as a target that refused the connection or timed out.
--reload and --resnapshot need --yes with --json, as there is no prompt. Standard output
holds only the document: whatever Python sources write there while they run, such as print(), a
child process’s output or os.write(1, …), goes to standard error.
Events
Section titled “Events”--events jsonl writes each load event to standard error as one line of JSON, as it happens.
--events-file PATH writes them to a file instead. Neither combines with --follow.
Prefect and Dagster shows how to send them to an orchestrator’s log.
$ sqlload load --events jsonl 2>&1 >/dev/null{"schema_version":0,"run_id":"6c3e27d9-…","at":"2026-11-15T02:24:32.303Z","event":"run_started","selected":2,"to_load":2}{"schema_version":0,"run_id":"6c3e27d9-…","at":"2026-11-15T02:24:32.307Z","table":"raw.items","event":"table_started","strategy":"replace"}…{"schema_version":0,"run_id":"6c3e27d9-…","at":"2026-11-15T02:24:32.326Z","table":"raw.items","event":"table_failed","reason":"checks.min_rows failed: 1 row staged, fewer than the 1,000 required; nothing was published","retryable":false,"elapsed_ms":18}{"schema_version":0,"run_id":"6c3e27d9-…","at":"2026-11-15T02:24:32.326Z","table":"raw.orders","event":"table_done","rows":3,"elapsed_ms":18}{"schema_version":0,"run_id":"6c3e27d9-…","at":"2026-11-15T02:24:32.326Z","event":"run_finished","loaded":1,"failed":1,"not_started":0,"rows":3,"elapsed_ms":71,"exit_code":1,"peak_memory_bytes":86921216}The events are version 0: names and fields can still change in a minor release until
schema_version is 1. Every event has schema_version, run_id, at (RFC 3339, UTC) and event.
A table’s events also have table, named as plan names it.
event |
Fields |
|---|---|
connected |
Before run_started: a target’s or source’s connection opened, or failed. role (target or source), name, label (what it reached, such as OPENEDGE through ODBC), ok and elapsed_ms. No table. |
discovered |
Before run_started: a source’s tables were found, or that failed. source, tables (how many), ok and elapsed_ms, timed from its connection when it has one. No table. |
run_started |
selected and to_load: the tables selected, and those the load starts. |
table_started |
strategy: the write strategy, as plan shows it. |
table_progress |
unit (page, batch, window or file), the count read so far, and rows so far. |
rate_limited |
connection, its rate_limit as rate, and wait_ms, how long a request waited. No table. |
table_committing |
rows: the table’s rows are read and its last commit starts. |
table_done |
rows, elapsed_ms, and position, the cursor value reached, when it keeps one. Also changes (the created and altered lines of a table that made or widened columns while loading), and transforms, names, warnings and peak_memory_bytes as in the JSON report. |
table_failed |
reason, retryable, elapsed_ms, and peak_memory_bytes under --memory-per-table. |
table_not_started |
reason, such as the table that stopped a --fail-fast load. |
run_finished |
loaded, failed, not_started, rows, elapsed_ms, exit_code and peak_memory_bytes, the run’s peak memory. |
--progress sets when load draws its live block on standard error. The default, auto, draws it
on a terminal, but not under --json or --log-format json. always draws it on a terminal
anyway, and never leaves it out. Output that isn’t a terminal never has the block or colours.