← Blog
A tracing-paper page lifts from a sketchbook, revealing two outlines of a lake with one bend marked in orange.
Published on
2026-11-27

Reproduce a DuckLake report after the data changes

The May 1 dispatch report counted 30 parcels. Later, someone corrected a shipment from 20 parcels to 25. Run the report again and it says 35. Both totals make sense, but only one answers the question a colleague asks a week later: “What did we report that day?”

DuckLake can answer that question if you record the snapshot used for the report. In our test, a separate process opened the catalog read-only and returned 30 from the recorded snapshot and 35 from the current table. The date filter stayed the same. The snapshot selected which version of the shipments the query could see.

Set up a shipment table you can change

For a local run, start DuckDB in a new working directory and run the SQL below. It creates a catalog file named report.ducklake and stores table data under report-data/. The catalog records which files and rows belong to each version. We used DuckDB 1.4.3 and DuckLake extension build de813ff.

INSTALL ducklake FROM core;
INSTALL httpfs FROM core;
LOAD ducklake;

ATTACH 'ducklake:report.ducklake' AS lake
    (DATA_PATH 'report-data/', DATA_INLINING_ROW_LIMIT 0);

Setting DATA_INLINING_ROW_LIMIT to zero makes the small inserts write to Parquet. DuckLake can otherwise keep small changes in the catalog itself. This matters if you are testing whether another worker can actually read your storage. How DuckLake stores small writes.

CREATE TABLE lake.shipments (
    shipment_id INTEGER,
    shipped_on DATE,
    parcels INTEGER
);

INSERT INTO lake.shipments VALUES
    (101, DATE '2026-05-01', 10),
    (102, DATE '2026-05-01', 20),
    (103, DATE '2026-05-02', 40);

Pin the report before the correction

The fixture has a single writer. After the insert commits, record the latest visible snapshot ID and run the report against that ID. This keeps the version you record and the version you query together, even if someone commits another change in between. DuckLake’s snapshot history.

SET VARIABLE report_version = (
    SELECT max(snapshot_id) FROM lake.snapshots()
);
SELECT getvariable('report_version') AS snapshot_id;
SELECT sum(parcels) AS parcel_total
FROM lake.shipments AT (VERSION => getvariable('report_version'))
WHERE shipped_on = DATE '2026-05-01';

Our snapshot ID was 2. Shipments 101 and 102 contributed 10 and 20 parcels. Shipment 103 fell on May 2, so its 40 parcels stayed out of the total. Save the ID with the catalog identity, report SQL, date parameter and result. A snapshot number is meaningful within its own catalog, and a session variable disappears when the connection closes.

Correct one shipment and reopen the catalog

Run the update in the writer session, let it commit, then close that session. The shipment still belongs to May 1. Only its parcel count changes.

UPDATE lake.shipments
SET parcels = 25
WHERE shipment_id = 102;

Start a new DuckDB session in the same working directory. Attach the existing catalog read-only and enter the ID you saved. Replace 2 if your run produced a different ID.

LOAD ducklake;
ATTACH 'ducklake:report.ducklake' AS lake (READ_ONLY);
SET VARIABLE report_version = 2;

Run the current report below. Then rerun the earlier report containing AT (VERSION => …) in this same session.

SELECT sum(parcels) AS parcel_total
FROM lake.shipments
WHERE shipped_on = DATE '2026-05-01';

The current query returned 35. The pinned query still returned 30. Filtering on the shipment date alone cannot recover what the table contained before the correction. If your real report joins several DuckLake tables, read each from the intended snapshot or attach the catalog at that version for the whole report. DuckLake time travel by version or timestamp.

Check that another worker can read the bucket

To repeat the exercise on object storage, start with a fresh catalog and an empty prefix in a test bucket. On each worker, load httpfs and configure a DuckDB S3 secret for your endpoint, region and credentials. In the writer’s setup, use the attachment below in place of the local one and substitute your bucket name. The reader then reopens the same catalog with access to the recorded data path. DuckDB’s S3 connection settings.

ATTACH 'ducklake:report.ducklake' AS lake
    (DATA_PATH 's3://ducklake-report/warehouse/', DATA_INLINING_ROW_LIMIT 0);

We used a local S3-compatible service and counted three Parquet objects after the correction, including a delete file. The read-only process fetched all three across the two queries. In a fresh process we then denied access to those objects. The catalog opened, but the query for snapshot 2 returned HTTP 403. An object listing cannot tell a reader which rows belong in the report. Querying Parquet files directly with DuckDB.

Keep the report reproducible for as long as it is needed

Choose how long someone must be able to reproduce the report. Retain the snapshot and its referenced data and delete files for that period, and protect the catalog with a recoverable backup. Expiring snapshots removes historical access, while file cleanup is a separate operation. A bucket lifecycle rule that deletes a referenced file can break a retained snapshot. DuckLake snapshot expiration.

To evaluate Object Storage with Hivenet for this workload, run the two-process test with a disposable prefix and your own credentials. Give the second process read access to the catalog and objects, then check that the original and corrected totals both match your records. Our storage test used a local emulator.

Your next workload belongs on Hivenet.

Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.