To put DuckLake on S3, set the DuckLake data_path to an S3 prefix and give the connection S3 credentials. The Parquet data files go to the bucket. The catalog stays in a small SQL database. This guide shows the full setup with Sling, and the output of each step from a real run.
Our test run used a local MinIO server as the S3 endpoint and a SQLite file as the source database, so you can do it again on a laptop. For AWS S3, you remove three settings from the connection (s3_endpoint, url_style, use_ssl). For a PostgreSQL source, see PostgreSQL to DuckLake with Sling.
What goes to S3 and what stays in the catalog?
DuckLake keeps two types of data in two locations:
- Data files. The rows, as Parquet files. These go to
data_path, which is the S3 bucket here. When you update or delete rows, DuckLake also writes small delete files here. - The catalog. Tables, columns, snapshots, and the list of data files for each table. This is a SQL database: DuckDB, SQLite, PostgreSQL or MySQL.
DuckLake never changes a Parquet file after it writes it. A commit adds new files and adds rows to the catalog in one transaction. Thus S3 does not have to support transactions. The catalog database does that work.
After the run below, the catalog was a 156 KB SQLite file, and the bucket held about 1.5 MB of Parquet. Back up the catalog. If you lose it, the Parquet files stay in the bucket, but you lose the table definitions and the list of which files belong to the current version of each table.
Prerequisites
- The Sling CLI:
curl -fsSL https://slingdata.io/install.sh | bash - An S3 bucket, or an S3-compatible store (MinIO, Cloudflare R2)
- An access key that can read and write objects in the bucket
- A source database. This guide uses a SQLite file.
You do not install DuckDB. Sling downloads the DuckDB CLI on first use and runs the ducklake extension in it. For DuckLake, Sling uses DuckDB 1.5.5 by default (see the warning about DuckDB 2.0 below).
How do you configure a DuckLake connection for S3?
Add the connection to ~/.sling/env.yaml. This is the connection from the run, with a SQLite catalog file and the data path on the local MinIO server:
connections:
MY_DUCKLAKE:
type: ducklake
catalog_type: sqlite
catalog_conn_string: /data/lake/catalog.sqlite
data_path: s3://lake-bucket/ducklake/
s3_access_key_id: ${AWS_ACCESS_KEY_ID}
s3_secret_access_key: ${AWS_SECRET_ACCESS_KEY}
s3_region: us-east-1
# only for MinIO and other S3-compatible stores:
s3_endpoint: 127.0.0.1:9000
url_style: path
use_ssl: false
MY_SOURCE:
type: sqlite
instance: /data/source.db
For AWS S3, remove the last three keys. For Cloudflare R2, set data_path: r2://bucket/path/ and s3_endpoint: <account-id>.r2.cloudflarestorage.com. The DuckLake connection docs list the Azure and GCS keys.
Test both connections:
sling conns test MY_SOURCE
sling conns test MY_DUCKLAKE
INF success!
INF success!
The replication file
One YAML file describes the load. Two tables use full refresh. The events table uses incremental mode with a timestamp column:
# source_to_ducklake_s3.yaml
source: MY_SOURCE
target: MY_DUCKLAKE
defaults:
object: demo.{stream_table}
streams:
main.customers:
mode: full-refresh
main.products:
mode: full-refresh
main.events:
mode: incremental
primary_key: [event_id]
update_key: event_at
object: demo.{stream_table} writes each stream to the demo schema of the lake and keeps the source table name. Sling creates the schema if it does not exist.
Full load
sling run -r source_to_ducklake_s3.yaml
Output, with the connection lines removed:
INF Sling Replication [3 streams] | MY_SOURCE -> MY_DUCKLAKE
INF [1 / 3] running stream main.customers
INF writing to target database [mode: full-refresh]
INF created table "demo"."customers"
INF inserted 20000 rows into "demo"."customers" in 1 secs [13,192 r/s] [1.2 MB]
INF [2 / 3] running stream main.products
INF inserted 3000 rows into "demo"."products" in 1 secs [2,398 r/s] [84 kB]
INF [3 / 3] running stream main.events
INF getting checkpoint value (event_at)
INF writing to target database [mode: incremental]
INF inserted 82000 rows into "demo"."events" in 1 secs [51,783 r/s] [4.4 MB]
INF Sling Replication Completed in 4s | MY_SOURCE -> MY_DUCKLAKE | 3 Successes | 0 Failures
On the first run, Sling also logs one ERR Catalog Error: Table with name ... does not exist line for each new table. Sling checks for the table before it creates it. The run continues and the tables are correct.
What is in the bucket after the load?
List the bucket. DuckLake writes one folder for each table under data_path:
297KiB ducklake/demo/customers/ducklake-01a1edec-3f49-....parquet
1.1MiB ducklake/demo/events/ducklake-01a1edec-4ad1-....parquet
31KiB ducklake/demo/products/ducklake-01a1edec-4471-....parquet
The catalog gives the same information. Run the queries through Sling:
sling conns exec MY_DUCKLAKE "select table_name, file_count, file_size_bytes from ducklake_table_info('ducklake')"
+------------+------------+-----------------+
| TABLE_NAME | FILE_COUNT | FILE_SIZE_BYTES |
+------------+------------+-----------------+
| customers | 1 | 304354 |
| products | 1 | 31981 |
| events | 1 | 1200087 |
+------------+------------+-----------------+
Sling attaches the lake under the name ducklake, so the DuckLake functions take 'ducklake' as the catalog name.
How do incremental loads work on S3?
For the second run, we added 2,500 new events to the source and changed 100 old events. The changed rows got a new event_type, a new amount, and a newer event_at. Then we ran the same file again for the events stream:
sling run -r source_to_ducklake_s3.yaml --streams main.events -d
The debug lines show each step:
INF getting checkpoint value (event_at)
DBG select max("event_at") as max_val from "demo"."events"
DBG select * from "main"."events" where ("event_at" > '2026-07-27 22:40:00.000000')
DBG merging from temporary table "main"."events_sling_duckdb_tmp" to final table "demo"."events" with primary keys [event_id], strategy: update_insert
INF inserted 2600 rows into "demo"."events" in 1 secs [1,974 r/s] [137 kB]
- Sling reads
max(event_at)from the DuckLake table. The target table is the checkpoint. There is no state file. - Sling reads only the source rows that are newer than the checkpoint: 2,500 new rows and the 100 changed rows, 2,600 in total.
- Sling runs a
MERGE INTOonevent_idwith the defaultupdate_insertmerge strategy.
Count the rows and the keys to make sure that the merge did not add duplicates:
sling conns exec MY_DUCKLAKE "select count(*) as total, count(distinct event_id) as distinct_keys from demo.events"
+-------+---------------+
| TOTAL | DISTINCT_KEYS |
+-------+---------------+
| 84500 | 84500 |
+-------+---------------+
82,000 + 2,500 = 84,500. The 100 changed rows replaced the old versions. For more about primary_key and update_key, see upserts with Sling.
What does a merge write to S3?
The merge does not rewrite the first Parquet file. It adds files next to it:
1.1MiB ducklake/demo/events/ducklake-01a1edec-4ad1-....parquet
3.0KiB ducklake/demo/events/ducklake-01a1edec-58f9-....parquet
45KiB ducklake/demo/events/ducklake-01a1edec-58fb-72ca-....parquet
1.3KiB ducklake/demo/events/ducklake-01a1edec-58fb-7306-...-delete.parquet
sling conns exec MY_DUCKLAKE "select table_name, file_count, delete_file_count from ducklake_table_info('ducklake') where table_name = 'events'"
+------------+------------+-------------------+
| TABLE_NAME | FILE_COUNT | DELETE_FILE_COUNT |
+------------+------------+-------------------+
| events | 3 | 1 |
+------------+------------+-------------------+
The delete file marks the 100 old row versions as deleted. The two new data files hold the new and the changed rows. Each incremental run adds more small files. Plan a regular compaction with the DuckLake maintenance functions, for example ducklake_merge_adjacent_files. Run it from DuckDB, not from the Sling replication.
How do you query an older snapshot?
Each commit adds a snapshot to the catalog:
sling conns exec MY_DUCKLAKE "select snapshot_id, schema_version, changes from ducklake_snapshots('ducklake') order by snapshot_id"
+-------------+----------------+------------------------------------------------------------+
| SNAPSHOT_ID | SCHEMA_VERSION | CHANGES |
+-------------+----------------+------------------------------------------------------------+
| 0 | 0 | {"schemas_created":["main"]} |
| 1 | 1 | {"schemas_created":["demo"]} |
| 2 | 2 | {"tables_created":["demo.customers"]} |
| 3 | 2 | {"tables_inserted_into":["2"]} |
| 4 | 3 | {"tables_created":["demo.products"]} |
| 5 | 3 | {"tables_inserted_into":["3"]} |
| 6 | 4 | {"tables_created":["demo.events"]} |
| 7 | 4 | {"tables_inserted_into":["4"]} |
| 8 | 4 | {"tables_deleted_from":["4"],"tables_inserted_into":["4"]} |
+-------------+----------------+------------------------------------------------------------+
Snapshot 8 is the merge: one delete and one insert on table 4 (events). Snapshot 7 still points to the first data file, so you can read the table as it was before the merge:
sling conns exec MY_DUCKLAKE "select event_id, event_type, amount from demo.events at (version => 7) where event_id = 1"
+----------+------------+--------+
| EVENT_ID | EVENT_TYPE | AMOUNT |
+----------+------------+--------+
| 1 | view | |
+----------+------------+--------+
The current version of the same row has event_type = refund and amount = -10.
How do you read the lake from DuckDB?
Any DuckDB client with the ducklake extension can attach the same catalog. The catalog stores the data_path, so you give DuckDB only the S3 credentials:
INSTALL ducklake;
LOAD ducklake;
CREATE SECRET (
TYPE s3, KEY_ID '...', SECRET '...', REGION 'us-east-1'
);
ATTACH 'ducklake:sqlite:/data/lake/catalog.sqlite' AS lake (READ_ONLY);
SELECT count(*) FROM lake.demo.events; -- 84500
SELECT count(*) FROM lake.demo.events AT (VERSION => 7); -- 82000
We ran these statements with the DuckDB 1.5.5 CLI against the lake from the test run.
Which catalog should you use in production?
A SQLite file catalog is enough when the clients run on one machine. SQLite allows one writer at a time, and DuckLake retries when it gets a lock conflict. When clients on more than one machine must use the same lake, put the catalog in PostgreSQL 12 or newer:
connections:
MY_DUCKLAKE:
type: ducklake
catalog_type: postgres
catalog_conn_string: "host=catalog-host port=5432 user=ducklake password=${CATALOG_PASSWORD} dbname=ducklake_catalog"
data_path: s3://my-bucket/ducklake/
s3_access_key_id: ${AWS_ACCESS_KEY_ID}
s3_secret_access_key: ${AWS_SECRET_ACCESS_KEY}
s3_region: us-east-1
Then Sling can load the lake from one machine while analysts query it from other machines. The PostgreSQL catalog controls the commits. S3 holds the files.
Do not mix DuckDB versions on a DuckDB file catalog. DuckLake 1.1 ships with DuckDB 2.0. The Sling DuckLake docs say that a DuckDB 2.0 write upgrades a DuckDB catalog file, and older clients cannot open it after that. Thus Sling stays on DuckDB 1.5.5 for DuckLake. Set duckdb_version: 2.0.0 on the connection only when all clients of the catalog use DuckDB 2.0.
To run the load on a schedule, run sling run -r source_to_ducklake_s3.yaml from cron, a systemd timer, Airflow or Dagster.
Frequently asked questions
How do I store DuckLake data on S3? Set data_path to an S3 prefix, for example s3://my-bucket/ducklake/, and give the connection S3 credentials (s3_access_key_id, s3_secret_access_key, s3_region). DuckLake writes the Parquet data files under that prefix. The catalog stays in a separate database: DuckDB, SQLite, PostgreSQL or MySQL.
Does Sling need DuckDB installed to write to DuckLake on S3? You do not install DuckDB yourself. Sling downloads the DuckDB CLI on first use and runs the ducklake extension in it. For DuckLake, Sling uses DuckDB 1.5.5 by default. Set duckdb_version to change it.
Can Sling run incremental loads into DuckLake on S3? Yes. Use mode: incremental with an update_key and a primary_key. Sling reads max(update_key) from the DuckLake table, reads only newer source rows, and runs a MERGE on the primary key. DuckLake records the changed rows in a delete file and writes the new versions to new Parquet files.
Does DuckLake work with MinIO, Cloudflare R2 or other S3-compatible storage? Yes. For MinIO, set s3_endpoint, url_style: path and use_ssl: false when the endpoint has no TLS. For R2, use an r2:// data path and set s3_endpoint to <account-id>.r2.cloudflarestorage.com.
Which catalog should I use with an S3 data path? A DuckDB file catalog is for one client. A SQLite file catalog is for several clients on one machine, with one writer at a time. Use PostgreSQL when clients on more than one machine must use the same lake. The DuckLake docs do not recommend MySQL as a catalog.
Related guides
- What is DuckLake?: the format, the catalog, and when to use it
- PostgreSQL to DuckLake: the same load from a PostgreSQL source
- Load data from many databases into DuckLake: MySQL, SQL Server and other sources
- Export PostgreSQL to Cloudflare R2 as Parquet: plain Parquet on object storage, with no catalog
- Load PostgreSQL into Apache Iceberg: the Iceberg target, if other engines must write the tables


