LOAD INTO
LOAD INTO sr.silver.pedidos -- conn[.schema].table, or a quoted path
USING stream_load -- load path; optional, starrocks/doris only
UPSERT ON (empresa, num_pedido) -- disposition (below)
SPLIT BY (num_pedido) JOBS 4 -- key-range parallel load
WITH (label_prefix = 'noturno') -- overrides the connection's label_prefix
AS
<query>;
- File target by quoted path — the extension picks the writer:
LOAD INTO '/out/x.csv',LOAD INTO '/out/x.parquet',LOAD INTO '/out/x.arrow'(Arrow IPC file; also.feather,.ipc, and.arrowsfor the stream format, local paths only), or an object-store pathLOAD INTO 'az://account/container/bronze/x.parquet'orLOAD INTO 's3://bucket/bronze/x.parquet'. USING stream_loadnames the one load path StarRocks and Doris have, and may be left out; on any other target, or with another name, it is an error.- A per-row dynamic target uses
IDENTIFIER(<string-expr>)over loop vars (FOR EACH):LOAD INTO sr.IDENTIFIER('crm_' || lower($name)) .... A file target built this way must end in a literal extension, which picks the writer. .xlsxis read but never written: a workbook target is a plan-time error.UPSERTneeds a table to merge into; on a file target it is a plan-time error.WITH (...)on aLOAD INTOtakesdelimiterandformat(a file) andlabel_prefix(StarRocks, Doris); any other key is a plan-time error rather than ignored.- Dispositions on a table target:
APPEND(default, omissible) ·REPLACE(overwrite) ·UPSERT ON (k1, k2)·UPSERT ON (id) PARTIAL COLS (a, b)· bareUPSERT(infer the PK from the source table’s metadata at plan time — needs a table read on a SQL source that exposes it). An empty/unresolved upsert key is an error, never a silent no-op. - Dispositions on a file target — the omissible default is not
APPEND: a bareLOAD INTO 'x.csv', likeREPLACE, creates or truncates the file, so a rerun replaces it. ExplicitAPPENDaccumulates for CSV only: the file is opened without truncating and the header row is written only when it was absent or empty. ExplicitAPPENDis a plan-time error for.parquetand Arrow IPC (the footer indexes every row group or batch and is written last, so appending means rewriting the file), foraz:///s3://(an object is replaced on write, never extended), and forsftp:///smb://(the file is written beside the target and renamed over it) — useREPLACE, a per-run path, orINTO BUFFER(HTTP mode). SPLIT BY (col)parallelizes the load by key ranges;JOBS nfixes the lane count (otherwise the CLI-japplies).
stdout is not syntax: a terminal SELECT ...; statement prints the result
as an aligned table — basalt run -c "SELECT * FROM 'x.csv'" works as a
mini-DuckDB.