Skip to content

Guides

Load files

Load Parquet, CSV, JSON or NDJSON files from a local folder, S3, Google Cloud Storage or an SFTP server, load only new files or new partitions, and let the warehouse read the files itself.

A files source loads every file under a folder into one table. This guide loads a local folder, then S3, Google Cloud Storage and an SFTP server. Every setting is on the Files source page.

A filesystem connection names a local folder; the source’s path is a folder below it:

default_target = "local"
[connections.lake]
kind = "filesystem"
root = "lake"
[connections.warehouse]
kind = "duckdb"
database = "shop.duckdb"
[targets.local]
connection = "warehouse"
loader_schema = "raw"
[sources.events_log]
kind = "files"
connection = "lake"
path = "events/"
format = "parquet"
description = "Click events, one row per event."
write_strategy = "append"

format is parquet (the default), csv, json or ndjson. The table is named after the source and needs a description. Under append, each run loads only new files. After one more file arrives:

$ sqlload plan -v
…
└── raw.events_log append
├── source files lake/events/ parquet
├── route DuckDB reads directly from lake/events/ (nothing through the loader)
├── columns 2
├── files 1 new of 4 listed
└── batch 1 batch, up to 1,000 files or about 1 GB per commit
✓ Plan complete 1 selected, 1 to load
$ sqlload load
✓ Plan complete 1 to load (sqlload plan shows the tree)
loaded raw.events_log 3 rows 0.0s
…

A file rewritten in place after it loaded fails the table, with the fix. When files change, load by partition.

Hive key=value folders, such as events/dt=2026-11-08/, load as typed columns. With delete_insert on a partition cursor, each run replaces the newest loaded partition and loads everything after it:

[sources.events]
kind = "files"
connection = "lake"
path = "events/"
format = "parquet"
description = "Click events, partitioned by day."
partition_columns = { dt = "date" }
write_strategy = "delete_insert"
cursor_column = "dt"
$ sqlload plan -v
…
└── raw.events delete_insert (cursor: dt)
├── source files lake/events/ parquet
├── route DuckDB reads directly from lake/events/ (nothing through the loader)
├── reads dt >= 2026-11-08 (warehouse maximum)
├── columns 2
├── files 2 new of 3 listed
└── commits 1 batch, up to 1,000 files or about 1 GB per commit
✓ Plan complete 1 selected, 1 to load
$ sqlload load
✓ Plan complete 1 to load (sqlload plan shows the tree)
loaded raw.events 6 rows 0.0s
…

A partition is never split across commits. For paths that aren’t key=value, such as orders/eu/2026-11-08/part-0.parquet, see Columns from paths.

An s3 connection names a bucket; the source is the same as for a folder:

[connections.lake]
kind = "s3"
bucket = "example-bucket"
region = "eu-west-2"
[sources.events]
kind = "files"
connection = "lake"
path = "events/"
format = "parquet"
description = "Click events, partitioned by day."
partition_columns = { dt = "date" }
write_strategy = "delete_insert"
cursor_column = "dt"

SQLLoad finds AWS credentials in the environment, the shared credentials file, web identity, or the instance or container role. See the s3 connection for profile and custom endpoints.

A gcs connection names a bucket:

[connections.lake]
kind = "gcs"
bucket = "example-bucket"
service_account_key = "${ENV:GCS_KEY}"
hmac_key_id = "GOOG1EXAMPLE"
hmac_secret = "${ENV:GCS_HMAC_SECRET}"

Without service_account_key, SQLLoad uses Google’s application default credentials. The HMAC key lets DuckDB and MotherDuck read Parquet in GCS themselves. See the gcs connection.

An sftp connection reads from an SFTP server, such as a partner’s daily drop:

[connections.partner]
kind = "sftp"
host = "sftp.partner.example"
user = "export"
private_key_file = "~/.ssh/partner_ed25519"
known_hosts = "~/.ssh/known_hosts"
[sources.orders]
kind = "files"
connection = "partner"
path = "outgoing/orders/"
format = "csv"
write_strategy = "append"
description = "Orders the partner drops each day."
  • The server’s host key must be in known_hosts. An unknown key fails before anything is listed, with its fingerprint and the command that adds it.
  • path is below the user’s login folder, or from / when it starts with /.
  • append notices a file rewritten in place by its size and modification time.
  • The rows always pass through SQLLoad, and SQLLoad never changes files on the server.

See Files on an SFTP server and the sftp connection.

When the destination can load the files exactly by itself, it does, and no row passes through SQLLoad. plan names the route on each table’s route line:

Destination Reads the files itself
DuckDB, MotherDuck Parquet in S3, GCS (with an HMAC key) or, for DuckDB, a local folder.
Snowflake Parquet, JSON, NDJSON and CSV under the url of an external_stage load method, with COPY.
Databricks Parquet in S3 under a Unity Catalog external location, with COPY INTO.
ClickHouse Parquet in S3, with s3().
BigQuery Parquet in GCS, as temporary external tables, on a table that excludes _sqlload_source_row.

SQLLoad reads the files itself for a table that changes its rows before they load: one with a transform, a parse, checks, row_id, unnest, a flatten of the files’ objects, or a column masked with hmac. Into DuckDB, Databricks and ClickHouse, so does a table whose files they can’t load exactly, such as another format.

Into Snowflake, files no external stage covers fail plan, unless the source sets copy_to_internal_stage = true, which uploads them to the user stage first and is much slower. To have Snowflake read files in S3 in place, give the connection an external stage over the bucket:

[connections.wh]
kind = "snowflake"
# ...
load_method.type = "external_stage"
load_method.url = "s3://example-bucket/"
load_method.storage_integration = "LAKE_INT"

Into Snowflake, a column the direct COPY can’t load exactly, such as Float16 or a decimal over 38 digits, fails plan and names it. See Files into Snowflake, Parquet files in S3 on Databricks, and Files ClickHouse reads itself.