ducklake README

The project's README from github.com/duckdb/ducklake. As one markdown file: README.md.

DuckLake logo

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
# to build with multiple cores, use `make GEN=ninja release`
make pull
make

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

ducklake (duckdb/ducklake)

Searching Database…

这是什么?DuckLake 是一种开放的湖仓表格式:数据存在 Parquet 文件里,元数据/目录信息存在 SQL 数据库里,以 DuckDB 扩展的形式实现。
这是一种文件格式,还是数据库引擎本身?它是一种表格式外加一个 DuckDB 扩展:它定义数据(Parquet)和元数据(目录数据库)的组织方式,DuckDB 可直接读写。
怎么开始使用 DuckLake?先用 DuckDB 的 INSTALL 命令安装,然后 ATTACH 一个 DuckLake 数据库,指向一个元数据文件(例如 metadata.ducklake)和一个数据目录,之后就能用标准 SQL 建表和查询。
除了 DuckDB,使用它还需要别的吗?只需要 DuckDB 本身(装好扩展即可);目录元数据存在一个 DuckDB 数据库文件里,数据则写入指定路径目录下的 Parquet 文件。
如果我想要最新功能,有 nightly/开发版吗?有。除了稳定发布渠道之外,还可以安装 corenightly 开发版。
我的数据实际存在哪里?数据存放在你自己的文件系统/存储上、由你掌控的 Parquet 文件中,目录元数据则存在单独的 DuckDB 数据库文件里——两者都在本地,都由你掌控。
DuckLake 支持时间旅行和模式演进吗?支持。README 把时间旅行(Time Travel)、模式演进(Schema Evolution)、更新(Updates)和变更数据订阅(Change Data Feed)列为 DuckLake 支持的特性。
DuckLake 只绑定 DuckDB,还是一项开放标准?它被描述为构建在 SQL 和 Parquet 之上的开放湖仓格式,DuckDB 是第一个能直接读写它的实现。
What are similar projects?ClickHouse, tidb, trino, oceanbase, dagster, duckdb, polyledger, libsql
Creator
duckdb
Size
8.3 MB
Stars
3.3K
Updated
CommitOct 17
Age
1y
Commits · 90 Days