Skip to content

Targets

Targets and load methods

Where loaded tables go, and how data gets there: files the warehouse reads itself, stages and bulk COPY.

A target is where loaded tables go. Wherever it loads the data exactly, SQLLoad lets the warehouse bulk-load files: straight from your bucket or folder, or from a stage SQLLoad fills with Parquet. plan names the route for every table.

Into Parquet files in S3, GCS or a folder CSV, JSON, NDJSON files Postgres or Python rows
DuckDB DuckDB reads them with read_parquet (in GCS, with an HMAC key) Read by SQLLoad, appended as Arrow Appended as Arrow
MotherDuck (beta) In S3, or in GCS with an HMAC key: MotherDuck’s servers read them with read_parquet. Otherwise read by SQLLoad, appended as Arrow Read by SQLLoad, appended as Arrow Appended as Arrow
Snowflake In S3: COPY from an external stage over the bucket. Otherwise read by SQLLoad, then loaded as rows are As for Parquet files Parquet to the load_method’s stage, then COPY; or streamed or inserted, by load_method
Databricks (beta) In S3: COPY INTO where they lie, through an external location. In a folder: staged by SQLLoad in the volume, then COPY INTO Read by SQLLoad, staged as Parquet in the volume, then COPY INTO Written as Parquet to the volume, then COPY INTO
BigQuery (beta) In GCS, on a table that excludes _sqlload_source_row: BigQuery queries them where they lie into a staging table. Otherwise read by SQLLoad, as for rows As for Parquet files Streamed as Arrow into a staging table, then one query job. From BigQuery on the same connection: INSERT ... SELECT
ClickHouse In S3: ClickHouse reads them with s3() into a staging table. In a folder: read by SQLLoad, sent as Arrow Read by SQLLoad, sent as Arrow into a staging table Sent as Arrow into a staging table, then swapped in by table or partition
Postgres Read by SQLLoad, then binary COPY into a temporary staging table As for Parquet files Binary COPY into a temporary staging table, then one transaction per commit

A Snowflake source into Snowflake stays inside Snowflake (see Snowflake loads the rows itself), and DuckDB, Databricks and ClickHouse read a Snowflake source’s S3 unload themselves (see Databricks and ClickHouse read the files themselves).

There are no silent fallbacks: if the route a table needs can’t be used, plan fails the table and says how to fix it.

A target names a connection and where tables go in it. A project can have several, such as one per environment; each source loads into its destination, or the project’s default_target.

Connection kind Target writes Places tables with
snowflake Snowflake tables loader_schema, and optionally database
databricks (beta) Unity Catalog tables loader_schema, in the connection’s catalog
bigquery (beta) BigQuery tables loader_schema as the dataset, in the connection’s project
clickhouse ClickHouse tables, on one self-hosted server loader_schema as the database
postgres Postgres tables loader_schema, and optionally database
duckdb DuckDB tables loader_schema
motherduck (beta) MotherDuck tables loader_schema, and optionally database
s3, filesystem Parquet or CSV files, one folder per table path

A warehouse target places tables in a schema (a dataset in BigQuery, a database in ClickHouse):

[connections.warehouse]
kind = "duckdb"
database = "shop.duckdb"
[targets.local]
connection = "warehouse"
loader_schema = "raw"
Key Meaning
connection A connection of a kind in the table above, other than s3 or filesystem.
loader_schema The schema for tables whose source sets no destination_schema. Required.
database Overrides the connection’s database. Not for ClickHouse.

A DuckDB connection’s database is a file path, or :memory:. A Snowflake connection also needs a load_method.

send says when a table’s rows reach its target. With send = "at_commit", each commit’s rows wait in local Arrow files and reach the target in one burst just before the commit, so a slow read doesn’t keep a billed warehouse running. It’s the default on Snowflake, Databricks and MotherDuck. With send = "per_batch", the default elsewhere, each batch goes to the target as it’s read.

[targets.cloud]
connection = "md"
loader_schema = "raw"
# the default on MotherDuck, Snowflake and Databricks
send = "at_commit"
# where the rows wait; the system's temporary folder by default
staging_dir = "/data/sqlload"

A source or table can set send too. It doesn’t move commits: once after the read for replace and --reload, after each window for batch_size, about every 1 GB for incremental reads, and every 1,000 files or about 1 GB for files sources. A read that fails partway sends nothing for its commit. The held files are removed after each commit.

plan shows a send line for each table under at_commit, with about how much a commit holds, and load fails before reading when staging_dir has less room. Where the target reads the files itself, such as Parquet DuckDB reads or an external_stage, the line says n/a: <target> reads the files itself.