DataSpanner

Getting Started with DuckLake: Build a Lakehouse on DuckDB in Under an Hour

By Dataspanner Editorial · · 5 min read · Data Engineering

Getting Started with DuckLake: Build a Lakehouse on DuckDB in Under an Hour — Data Engineering cover illustration

Introduction

Modern data architectures aim to combine the economical, limitless storage of a data lake with the strong, transactional guarantees of a data warehouse. Many teams spend weeks stitching together disparate tools, wrestling with schema evolution, and contending with performance bottlenecks.

DuckLake offers a different approach. It is an open lakehouse table format from the DuckDB team that stores metadata—schema, partitioning, statistics, and transaction logs—in a SQL database (typically DuckDB itself) while keeping the actual row data as Parquet files in inexpensive object storage (S3, GCS, Azure Blob, etc.). DuckLake 1.0 shipped in April 2026 with a stable specification and guaranteed backward compatibility, giving teams a mature, well‑defined foundation for lakehouse workloads.

The result is a lakehouse that can be provisioned, loaded with a few files, and queried quickly—without the need for a multi‑node cluster. This article walks through a hands‑on build and layers in the engineering perspective you’ll need to judge whether DuckLake fits your workload, its cost implications, and the pitfalls that trip up production deployments.

What Is DuckLake and Why It Matters

Core Idea

  • Metadata in a SQL store – Table definitions, partitioning schemes, stats, and a transaction log live in a regular relational database (usually DuckDB). This enables fast, declarative schema changes, ACID‑like guarantees for metadata, and straightforward backups.
  • Data in Parquet – The row data resides as columnar Parquet files in object storage. Parquet provides native compression, parallel reads, and compatibility with the broader ecosystem (Spark, Polars, DuckDB, etc.).

Because the metadata is stored in a standard SQL database, you can inspect, modify, and audit table definitions using ordinary SQL statements, just as you would with any other table.

When It Shines

Situation Why DuckLake Helps
Prototyping & ad‑hoc analytics Spin up a DuckDB instance, point it at a few Parquet files, and start querying without standing up a Spark or Trino cluster.
Edge & IoT pipelines The embedded nature of DuckDB works well on devices where a full‑blown cluster is impractical.
Low‑latency dashboards Schema look‑ups are instant via the SQL metadata store, while Parquet reads remain fast for modest data volumes.

When It Can Trip You Up

Issue Impact Mitigation
Single‑node metadata bottleneck Heavy concurrent metadata writes (e.g., many streaming inserts) can contend for locks on the DuckDB metadata DB. Use a shared DuckDB file on a network share or move metadata to a dedicated DBMS (PostgreSQL, MySQL).
Limited transaction scope DuckLake guarantees backward compatibility but does not support complex multi‑table commits or roll‑backs beyond simple appends. Design pipelines as append‑only or layer an external transaction coordinator (e.g., Kafka + schema registry).
Ecosystem lock‑in Although Parquet is universal, DuckLake‑specific extensions are only available in DuckDB and a few downstream tools. Evaluate Delta Lake or Iceberg if broad tooling support is required.

Quick Start (Conceptual)

Below is a minimal, runnable walkthrough that demonstrates the essential steps. All commands are commented for clarity and can be executed in a fresh Linux/macOS/Windows Bash shell (or Docker container). The example uses an in‑memory DuckDB instance; production deployments should persist the metadata DB to a file or shared storage.

1. Install DuckDB

# Install the latest DuckDB CLI
curl https://install.duckdb.org | sh
unzip duckdb.zip
chmod +x duckdb

Why this matters: DuckDB is a single‑file executable—no installation, no Java, no Hadoop. It is the smallest possible “database” you can run locally.

2. Create a workspace

mkdir -p ~/ducklake_demo && cd ~/ducklake_demo

3. Start DuckDB and enable DuckLake support

-- Start an in‑memory instance
./duckdb :memory:

If DuckLake support is not automatically loaded, enable it via the extension mechanism (if available):

INSTALL ducklake;
LOAD ducklake;

Dataspanner note: In production you will persist the metadata DB (e.g., ducklake.duckdb) rather than using :memory:.

4. Create a catalog and schema

CREATE OR REPLACE DATABASE my_catalog;
USE my_catalog;
CREATE OR REPLACE SCHEMA demo;
USE demo;

5. Write sample Parquet files

-- Generate a CSV source
cat > sales.csv <<EOF
id,product,amount,event_date
1,Widget,100,2024-01-01
2,Gadget,250,2024-01-02
3,Widget,150,2024-01-02
4,Thingamajig,75,2024-01-03
EOF

-- Export the CSV as Parquet (object‑storage path can be local for demo)
COPY (
  SELECT * FROM read_csv_auto('sales.csv')
) TO './raw_sales/' (FORMAT 'parquet');

For a real lakehouse, replace './raw_sales/' with an S3, GCS, or Azure Blob path.

6. Register the Parquet files as a DuckLake table

CREATE TABLE demo.sales_lakehouse AS
SELECT *
FROM read_parquet('./raw_sales/*.parquet');

The statement creates a DuckLake metadata entry that links demo.sales_lakehouse to the underlying Parquet files while keeping the data on object storage.

7. Verify the lakehouse properties

-- Inspect schema and file count
DESCRIBE TABLE demo.sales_lakehouse;

-- Row count via metadata
SELECT COUNT(*) FROM demo.sales_lakehouse;

-- Simple query with filter and aggregation
SELECT product, SUM(amount) AS total_amount
FROM demo.sales_lakehouse
WHERE event_date >= '2024-01-02'
GROUP BY product;

8. Append new data (simulating streaming writes)

# Append a new CSV batch locally
cat > sales_new.csv <<EOF
id,product,amount,event_date
5,Gadget,300,2024-01-04
EOF
-- Write the new Parquet partition and register it in DuckLake
COPY (
  SELECT * FROM read_csv_auto('sales_new.csv')
) TO 's3://my-bucket/ducklake/sales/event_date=2024-01-04/part-0.parquet' (FORMAT PARQUET);

Key Takeaways

  • DuckLake separates metadata from storage cleanly: table schemas and transaction logs live in a standard SQL database, while row data lives as compressed Parquet files in object storage.
  • Zero-cluster ergonomics: for small-to-medium analytical workloads, edge pipelines, and rapid prototyping, you get ACID-style metadata management without running Spark or Trino.
  • Watch the metadata lock: if many concurrent writers append simultaneously, move the metadata catalog from a local DuckDB file to PostgreSQL.

FAQ

Q: When should I choose DuckLake over Apache Iceberg? A: Choose DuckLake when your team is already DuckDB-first and wants minimal infrastructure overhead. Choose Apache Iceberg if multiple engines (Spark, Trino, Snowflake, Flink) need to write and read the same tables concurrently.

Q: Can I query DuckLake Parquet files from other tools? A: Yes. Because the underlying data files are standard Apache Parquet, Polars, Spark, and pandas can read the raw files directly, though DuckLake's SQL catalog metadata is DuckDB-native.

Q: How do I handle schema evolution? A: Schema changes are recorded as lightweight transactions in the SQL metadata catalog, avoiding expensive rewrites of existing Parquet data files.


Source context: Original announcement / coverage