DuckDB Ducklake
Summary
DuckLake 是一个基于 SQL 和 Parquet 构建的开放 Lakehouse 格式,其 DuckDB 扩展允许直接读写 DuckLake 数据,支持时间旅行、Schema 演进和变更数据流(CDC)等功能。
View Cached Full Text
Cached at: 10/08/26, 09:02 PM
duckdb/ducklake
Source: https://github.com/duckdb/ducklake
DuckDB DuckLake Extension
DuckLake is an open Lakehouse format that is built on SQL and Parquet. DuckLake stores metadata in a catalog database, and stores data in Parquet files. The DuckLake extension allows DuckDB to directly read and write data from DuckLake.
See the DuckLake website for more information.
Installation
DuckLake can be installed using the INSTALL command:
INSTALL ducklake;
The latest development version can be installed from core_nightly:
FORCE INSTALL ducklake FROM core_nightly;
Usage
DuckLake databases can be attached using the ATTACH syntax, after which tables can be created, modified and queried using standard SQL.
Below is a short usage example that stores the metadata in a DuckDB database file called metadata.ducklake, and the data in Parquet files in the file_path directory:
ATTACH 'ducklake:metadata.ducklake' AS my_ducklake (DATA_PATH 'file_path/');
USE my_ducklake;
CREATE TABLE my_ducklake.my_table(id INTEGER, val VARCHAR);
INSERT INTO my_ducklake.my_table VALUES (1, 'Hello'), (2, 'World');
FROM my_ducklake.my_table;
┌───────┬─────────┐
│ id │ val │
│ int32 │ varchar │
├───────┼─────────┤
│ 1 │ Hello │
│ 2 │ World │
└───────┴─────────┘
Updates
UPDATE my_ducklake.my_table SET val='DuckLake' WHERE id=2;
FROM my_ducklake.my_table;
┌───────┬──────────┐
│ id │ val │
│ int32 │ varchar │
├───────┼──────────┤
│ 1 │ Hello │
│ 2 │ DuckLake │
└───────┴──────────┘
Time Travel
FROM my_ducklake.my_table AT (VERSION => 2);
┌───────┬─────────┐
│ id │ val │
│ int32 │ varchar │
├───────┼─────────┤
│ 1 │ Hello │
│ 2 │ World │
└───────┴─────────┘
Schema Evolution
ALTER TABLE my_ducklake.my_table ADD COLUMN new_column VARCHAR;
FROM my_ducklake.my_table;
┌───────┬──────────┬────────────┐
│ id │ val │ new_column │
│ int32 │ varchar │ varchar │
├───────┼──────────┼────────────┤
│ 1 │ Hello │ NULL │
│ 2 │ DuckLake │ NULL │
└───────┴──────────┴────────────┘
Change Data Feed
FROM my_ducklake.table_changes('my_table', 2, 2);
┌─────────────┬───────┬─────────────┬───────┬─────────┐
│ snapshot_id │ rowid │ change_type │ id │ val │
│ int64 │ int64 │ varchar │ int32 │ varchar │
├─────────────┼───────┼─────────────┼───────┼─────────┤
│ 2 │ 0 │ insert │ 1 │ Hello │
│ 2 │ 1 │ insert │ 2 │ World │
└─────────────┴───────┴─────────────┴───────┴─────────┘
See the Usage guide for more information.
Building & Loading the Extension
To build, type
git submodule init
git submodule update --recursive
# to build with multiple cores, use `make GEN=ninja release`
make
The submodules are pinned to the DuckDB version in .github/duckdb-version, which is what CI builds against. make pull
moves them to the tip of their branch instead, where the build can fail.
To run, run the bundled duckdb shell:
./build/release/duckdb
Contributing
We are happy to welcome external contributions to our DuckLake extension. Our active development branch is currently main, and all contributions should target that branch.
Testing
# run all DuckLake extension tests
./build/release/test/unittest
# run a single test file
./build/release/test/unittest test/sql/transaction/create_conflict.test
# run tests matching a pattern
./build/release/test/unittest "test/sql/partitioning/*"
# run DuckDB core tests using DuckLake as storage backend
./build/release/test/unittest --test-config test/configs/attach_ducklake.json --test-dir duckdb
# run DuckLake tests using PostgreSQL as catalog database (requires running PostgreSQL)
./build/release/test/unittest --test-config test/configs/postgres.json
# run DuckLake tests using SQLite as catalog database
./build/release/test/unittest --test-config test/configs/sqlite.json
# run tests with deletion vectors enabled
./build/release/test/unittest --test-config test/configs/deletion_vectors.json
Similar Articles
DuckDB: it's not quack science
DuckDB is an open-source embedded analytical database that supports direct querying of files, embedding into applications, and provides friendly SQL extensions. It is more efficient than traditional Unix pipes in data analysis scenarios.
DuckDB 1.5.2 – SQL database that runs on laptop, server, in the browser
DuckDB 1.5.2 adds production-ready DuckLake v1.0 lakehouse format, Iceberg extension improvements, Jepsen testing, and a revamped browser shell with file storage.
@siddontang: Love this: DuckDB + SlateDB + S3. A real, writable database. One writer, many readers. No always-on server. Beautifully…
介绍 duckdb_object_storage——一个基于 SlateDB 与 Apache OpenDAL 的 DuckDB 社区扩展,可将原生 DuckDB 数据库直接存于 S3 等对象存储,无需额外运行目录服务或协调器,支持单写多读且性能接近本地原生 DuckDB。
Why DuckDB 2.0 is faster
MotherDuck 的技术博客详细解析 DuckDB 2.0 alpha 版本为何更快,重点介绍了通过独立下载线程池实现的异步 I/O,使 S3 上的 Parquet 查询性能显著提升,并分享了实际基准测试数据。
@guizmaii: DuckDB is the final boss of Data Engineering
Duckherder is a new DuckDB extension that enables distributed query execution across multiple worker nodes using Arrow Flight, aiming to enhance data engineering workflows with parallel processing.