Skip to content

Reference

sqlload.toml

Every key of a loader project's sqlload.toml: connections, targets, sources and table settings.

sqlload.toml configures a loader project. sqlload reads it from the working directory, or from -c/--config or SQLLOAD_CONFIG. Unknown keys are errors. See Projects for how the parts fit together. The Kafka exporter uses a different file.

default_target = "local"
[connections.app]
kind = "postgres"
host = "localhost"
user = "postgres"
password = "${ENV:PGPASSWORD}"
database = "postgres"
[connections.warehouse]
kind = "duckdb"
database = "shop.duckdb"
[targets.local]
connection = "warehouse"
loader_schema = "raw"
[sources.app]
kind = "postgres"
connection = "app"
include = ["public.*"]
write_strategy = "merge"
unique_key = "{primary_key}"
[sources.app.tables."public.orders"]
cursor_column = "updated_at"

${ENV:NAME} anywhere in the file is replaced with the environment variable NAME; an unset variable is an error. $${ is a literal ${. Write passwords, tokens and keys this way.

A linked key in the tables below links to the page that explains it.

Key Default Meaning
python_paths none Folders, relative to the file, scanned for Python sources.
default_target none The target for sources with no destination. Not needed with one target.
concurrency 4 The most tables loading at once. --concurrency overrides it.
memory_limit 80% of a container’s or Windows job object’s limit, else 50% of memory The memory a run stays under, such as "4GiB", or "off" for no budget. --memory-limit overrides it.
microbatch_concurrency false Allows batch_concurrency above 1.
[connections.NAME] How to reach a system.
[targets.NAME] Where loaded tables go.
[sources.NAME] Where data comes from.

Each connection has a kind.

For Postgres sources and targets.

Key Default Meaning
host required
port 5432
user required
password none
database required
sslmode prefer disable, prefer, require, verify-ca or verify-full, as in libpq.
sslrootcert none CA certificates (PEM) to trust instead of SQLLoad’s built-in public roots.
sslcert, sslkey none A client certificate and its key (PEM). Set both or neither.
ssh none A bastion to reach host through.

The ssh table:

Key Default Meaning
host required The bastion.
port 22
user required
private_key_file ssh-agent’s keys ~/ is the home folder.
private_key_passphrase none
password none Used when no private_key_file is set.
known_hosts ~/.ssh/known_hosts The file that must list the bastion’s host key.
Key Default Meaning
account required Such as myorg-myaccount.
user required
auth required { method = "key_pair", private_key_file = "..." }, { method = "pat", token = "${ENV:...}" } or { method = "oauth_authorization_code" } (browser).
role none
warehouse none
database required
load_method required for targets How data gets into Snowflake.

In beta. host, client_id, client_secret, warehouse_id, catalog and volume, all required except volume on a connection only a source uses. See Databricks.

In beta. See BigQuery.

Key Default Meaning
location required Where jobs run and datasets are created, such as EU.
service_account_key application default credentials A key file’s JSON text.
impersonate_service_account none A service account to act as, whoever signs in.
project see Connection The project tables load into and jobs run in.

See ClickHouse.

Key Default Meaning
host required
port 8123, or 8443 with secure The HTTP port.
user default
password none
secure false true for HTTPS.
Key Meaning
database The database file, or :memory:.

In beta, as a target and a source. Needs sqlload[motherduck]; see MotherDuck.

Key Default Meaning
database required, here or in the target With or without md:. It can’t hold the token.
token motherduck_token or MOTHERDUCK_TOKEN
load_method { type = "local" } Or { type = "external_stage", url = "s3://…" | "gs://…", connection = "…", keep_staged_files = false }.
Key Meaning
bucket The bucket.
region The bucket’s region.
endpoint A custom S3-compatible endpoint.
profile The shared credentials file profile to take keys from. Default: AWS_PROFILE, else default.

SQLLoad takes the first credentials it finds:

  1. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, with AWS_SESSION_TOKEN (not AWS_TOKEN).
  2. The shared credentials file (AWS_SHARED_CREDENTIALS_FILE, default ~/.aws/credentials), under the profile above.
  3. Web identity.
  4. The instance or container role.

A profile named by profile or AWS_PROFILE must hold aws_access_key_id and aws_secret_access_key, or the connection fails. SSO, assumed roles and credential_process in ~/.aws/config aren’t read. sqlload debug shows where each connection’s keys come from.

For an S3-compatible store without bulk delete, set AWS_DISABLE_BULK_DELETE=true.

A Google Cloud Storage bucket, for files sources and files targets.

Key Meaning
bucket The bucket.
service_account_key A service account’s JSON key, such as "${ENV:GCS_KEY}".
hmac_key_id, hmac_secret An HMAC key, so DuckDB and MotherDuck can read the bucket’s Parquet files themselves (Cloud Storage → Settings → Interoperability). Set both or neither.
endpoint A custom endpoint, such as an emulator’s.

SQLLoad takes the first credentials it finds:

  1. service_account_key.
  2. The file GOOGLE_APPLICATION_CREDENTIALS names, which must exist (any type listed under BigQuery authentication).
  3. gcloud’s application default credentials.
  4. The machine’s service account, from its metadata server.

They need roles/storage.objectViewer to read and roles/storage.objectUser to write or remove files. sqlload debug shows how each connection signs in.

Without an HMAC key, SQLLoad reads the files for DuckDB and MotherDuck, and plan -v says so. BigQuery needs none.

Key Meaning
root A folder on the machine SQLLoad runs on. On Windows, also a drive or share, in single quotes so backslashes stay: 'C:\data\lake', '\\server\share\lake'.

An SFTP server that files sources read.

Key Default Meaning
host required
port 22
user required
private_key_file none ~/ is the home folder.
private_key_passphrase none
password none Used when no private_key_file is set. Without either, ssh-agent’s keys.
known_hosts required The file that must list the server’s host key. The check can’t be turned off.

See ODBC. Set connection_string or dsn, not both.

Key Meaning
connection_string The driver’s connection string.
dsn A data source name.
user, password With dsn, when the DSN doesn’t hold them.

service_account_json, service_account_json_base64, service_account_file, or client_id and client_secret with an optional refresh_token; at most one way. Without any, GOOGLE_APPLICATION_CREDENTIALS. See Google Sheets.

For Python HTTP sources; table functions see it as ctx.connection.

Key Default Meaning
base_url required
auth none See below. Without it, requests carry no credential.
token none For bearer and api_key.
username, password none For basic and oauth2_password.
client_id, client_secret none For oauth2_client_credentials, and the other OAuth2 kinds when the API wants the client.
refresh_token none For oauth2_refresh_token.
headers none Sent with every request.
rate_limit none Requests started per second, minute or hour: "10/s", "600/m", "1000/h".
max_in_flight none The most requests open at once, 1 to 10,000.
retries 5 Retries after a transport error, 429 or 5xx; at most 100.

rate_limit and max_in_flight cover every request to the connection in one sqlload load, retries included. Separate processes don’t share them, so load one API’s tables in one sqlload load (in an orchestrator, one task per API).

auth Sends
{ kind = "bearer" } Authorization: Bearer <token>.
{ kind = "api_key", header = "X-Api-Key" } token in that header.
{ kind = "api_key", query = "key" } token in that query parameter.
{ kind = "basic" } Basic auth with username and password.
{ kind = "oauth2_client_credentials", token_url = "..." } A bearer token issued for client_id and client_secret. Optional scope; client_auth is basic (default) or post. See OAuth2.
{ kind = "oauth2_refresh_token", token_url = "..." } The same, issued for refresh_token.
{ kind = "oauth2_password", token_url = "..." } The same, issued for username and password.
[connections.shop]
kind = "http"
base_url = "https://api.example.com/v1"
token = "${ENV:SHOP_TOKEN}"
auth = { kind = "bearer" }
rate_limit = "10/s"
max_in_flight = 4

plan shows each http connection’s settings, never its credentials:

http shop rate_limit 10/s, max_in_flight 4, retries 5, auth bearer
Key Applies to Meaning
connection all A warehouse connection (snowflake, databricks, bigquery, clickhouse, postgres, duckdb, motherduck), or s3, gcs or filesystem for files.
loader_schema warehouses, required The schema for sources with no destination_schema: a BigQuery dataset, a ClickHouse database.
database warehouses but ClickHouse Overrides the connection’s database.
path files Each table’s folder: {source}, {schema}, {table}, {cursor}, {cursor:date}. Default {source}/{table}/.
format files parquet (default) or csv.
compression files, csv none (default), gzip or zstd.
csv files, csv { delimiter, header, quote, null_value }; default ,, true, ", empty string.
single_file files One file per table or partition, named after the table folder. Default false.
max_footer_reads files The most Parquet footers plan reads for one table. Default 100.
naming warehouses snake_case (default) or source.
compat warehouses sqlload (default) or dlt.
send warehouses at_commit (default on Snowflake, Databricks, MotherDuck) or per_batch (elsewhere).
staging_dir warehouses Where at_commit holds rows. Default: the system’s temporary folder.
json_type DuckDB, MotherDuck json (default) or variant.

A source or table may override naming, compat and send.

Key Applies to Meaning
kind all postgres, postgres_cdc, snowflake, odbc, bigquery, databricks, duckdb, motherduck, files or google_sheets. Python sources are declared in Python.
connection all The connection read.
description all The source’s description; a files source’s table description.
destination all The target; default_target when omitted.
destination_schema warehouse targets Where the tables land; the target’s loader_schema when omitted.
table_name all Destination name template: {source}, {schema}, {table}. Default {source}__{table}, or {source} for files.
destination_path files targets Overrides the target’s path.
include, exclude database sources schema.table patterns to sync and leave out (dataset.table on BigQuery).
new_tables database sources sync (default), skip or fail.
exclude_columns, allow_columns all Column patterns to leave out, and to keep anyway.
skip_tables_with_columns database sources Leave out tables with a column matching one of these patterns.
mask_key all The key for hmac masks, normally ${ENV:MASK_KEY}.
cdc_mode, slot, publication, batch_interval postgres_cdc See Postgres CDC settings.
warehouse snowflake The warehouse unloads run on; the connection’s by default.
stage snowflake { url, storage_integration, region } or { name }; the user stage by default.
max_text_size, max_binary_size odbc The longest text and binary value read, in bytes. See Value sizes.
max_batch_memory odbc The most one fetch of a table holds, such as "2GB". Default 512 MiB, or a quarter of the table’s share of the memory budget when less.
long_column_threshold odbc Above this per-value buffer, a column is read value by value. Default "4KiB".
project bigquery The tables’ project; the connection’s by default.
spreadsheet_id, ranges google_sheets The spreadsheet, and its tabs or A1 ranges by table name. See Source.
path files The folder holding the files, relative to the connection.
format files parquet (default), ndjson, json, csv, xlsx or xml.
compression files auto (default, by file name), none, gzip, zstd or zip.
csv files { delimiter, header, quote, null_values }; defaults ",", true, '"', [""]. Also escape, quote = false, encoding (utf-8), encoding_check (true) and skip_rows.
xlsx, xml, members files Worksheet and XML record options; members, with compression = "zip", a pattern member names must match. See Excel, XML and ZIP files.
pattern files A glob the path below path must match, such as "file_*.txt", instead of the format’s suffix.
after_load files "keep" (default), "delete" or { move_to = "<folder>" }.
shape files columns (default) or record: each JSON object or CSV line whole in one json column.
record_column files The column shape = "record" loads into. Default record.
partition_columns files Hive key=value folders as typed columns, such as { dt = "date" }.
path_columns files A path template whose captures load as typed columns, such as "{region}/{day:date}/*".
unmatched_paths files fail (default) or skip a file that doesn’t match path_columns.
order files modified (default) or path: the order merge and delete_insert by replace_key apply files in; the last wins.
on_empty files fail (default) or skip when the folder holds no files.
copy_to_internal_stage files into Snowflake Upload files no external stage covers to @~. Much slower.
[sources.NAME.tables."schema.table"] all Per-table settings. A files source’s table is named after the source.

Database sources are postgres, postgres_cdc, snowflake, odbc, bigquery, databricks, duckdb and motherduck. A source can also set any table setting, as the default for its tables.

A postgres_cdc source reads a postgres connection and takes include and exclude as a Postgres source does, plus:

Key Default Meaning
cdc_mode merge merge keeps one row per key; changelog appends every change. Files targets take changelog only.
deletes soft With merge: soft sets _sqlload_deleted_at; hard removes the row. A table setting.
slot sqlload_<source> The replication slot.
publication sqlload_<source> Created when missing.
batch_interval 10s, 1m into files How often load --follow writes. At least 1s.

Column settings work as for other sources. A captured table takes no write_strategy, cursor_column, batch_size or state. merge matches on the primary key; a unique_key must lie within it.

Set on a source for all its tables, or in a [sources.NAME.tables."schema.table"] entry for one; schema is the source schema. plan, apply and load check how settings combine before connecting; see Settings that don’t combine.

Key Default Meaning
write_strategy required append, merge, delete_insert or replace.
unique_key required for merge A column or list, or "{primary_key}" (not for Python, files or Google Sheets sources).
on_duplicate_keys dedupe merge rows of one commit repeating a key: dedupe keeps one, fail refuses the commit.
newest_by none Column or list whose higher value is the newer row: merge keeps the newest per key and never overwrites with an older one. Without it, the row read last wins.
null_keys match A NULL in a merge unique_key or delete_insert replace_key: match matches NULL to NULL; fail refuses the commit.
replace_key none delete_insert only, without cursor_column, so each load reads the whole source (a files source’s new and changed files). Each commit deletes the rows holding its values, then inserts.
on_overlapping_files fail Files delete_insert by replace_key when two files hold one value: fail refuses the later file, naming both; last_wins lets the last in order win.
deletes none soft or hard: what load --sync-deletes does with merge rows whose key left the source.
deletes_from none Table entry only: { table = "audit.deleted_items", cursor_column = "deleted_at" }, a source table of deleted keys. Each load copies its new rows into <table>__sqlload_deletes and applies deletes to the keys they name. Optional lookback.
cursor_column none The column runs continue from, or a list read as the first non-NULL.
cursor_start none Where the first run starts.
lookback none Read this far before the maximum: "2h" on a date or timestamp cursor, a number on an integer cursor.
lookback_from destination destination (its maximum) or now: what lookback counts back from.
lookahead none Read only values before now plus this.
append_cursor_inclusive false append reads from the maximum, not after it.
null_cursor fail fail, include (merge only) or ignore.
on_cursor_out_of_range fail Python tables with a cursor: fail, skip or warn.
cursor_bounds parameters ODBC only: parameters or literals.
batch_size none Commit one window at a time: "1d", an integer step, or "none".
batch_concurrency 1 Postgres tables with batch_size: windows read at once, up to 16, each on its own connection, still committed in order. Needs microbatch_concurrency.
timezone UTC IANA zone for times without an offset.
where none A condition in the source’s SQL, such as "status <> 'X'", added to every read. Database sources but postgres_cdc; not query tables. A table’s replaces its source’s. A row that later stops matching stays loaded, except under replace or deletes.
contract none none or enforced.
on_schema_change append_new_columns append_new_columns, ignore or fail.
auto_widen false Widen inferred columns along bool → int → decimal, timestamp_ntz → timestamp_tz.
infer_types true false loads inferred columns as text; pinned columns keep their types.
type_change_rebuild require_confirmation allow, require_confirmation or deny.
on_nonfinite keep Python tables and tables with a transform: null loads NaN and infinities in dict rows as NULL; keep fails the table where the column can’t hold them.
allow_empty false Python tables: true lets replace empty the table when the function yields nothing.
state stateless Python tables: logged keeps the position in the run log.
checks none { unique, not_null, min_rows, max_row_drop, warn }, run before publishing.
constant_columns none The same value in every row, such as { tenant_id = "acme" }, or { value, type }. Not on postgres_cdc. A table’s replaces its source’s. It replaces a files source’s column of that name; other sources fail plan on a clash.
unnest none Table entry only: list fields whose items become child-table rows, such as ["items"], or "all".
flatten none Table entry only: objects whose keys load as <object>__<key>, or "all" (the default for JSON and NDJSON files under compat = "dlt").
max_depth 1000 Table entry with unnest or flatten: the most levels.
parse none Table entry only: text columns read as times, such as { created = "epoch_ms" }.
naming the target’s snake_case or source.
rename none Such as { "Order ID" = "order_ref" }, or an @sl.rename function’s name.
on_duplicate_names number number or fail, for names equal ignoring case.
compat the target’s sqlload or dlt.
send the target’s at_commit or per_batch.
row_id false A unique id per row in _sqlload_row_id. Always on with unnest and under compat = "dlt" (as _dlt_id).
transform none Files and google_sheets sources: an @sl.transform function’s name, run on each file’s or range’s rows. Needs python_paths and the sqlload Python package.
column_names none Column names for CSV, Excel and google_sheets data without a header.
header, header_row google_sheets only. See Source.

ClickHouse and BigQuery targets also take these, for tables SQLLoad creates. Other targets and Python tables refuse them. See Table layout and Partitioning and clustering.

Key Default Meaning
engine MergeTree ClickHouse. A MergeTree-family engine with its arguments.
order_by the unique_key, else unsorted ClickHouse. An expression or list.
partition_by none Such as "toYYYYMM(updated_at)" or "DATE(updated_at)".
cluster_by none BigQuery. Up to 4 columns.
primary_key none ClickHouse. A prefix of order_by.
table_settings none Such as { index_granularity = 4096 } or { require_partition_filter = true }.

Only in a table entry:

Key Meaning
description The table’s description, which becomes its comment.
name The destination table name, overriding table_name.
sql A query whose rows are the table; the entry’s key is its name. Database sources but postgres and postgres_cdc.
columns Pinned types, such as { total = "decimal(18,2)" }.
mask { email = "hmac" } or "hash".
exclude_columns, allow_columns, destination_path As on the source.

Python tables take these settings as decorator arguments, except lookahead and lookback_from. See Python sources.