DuckLake Local Catalog Example
This example attaches a local DuckLake catalog backed by a DuckDB file and writes a small table. The catalog file and data directory go into a fresh directory under the OS temp directory, which the script removes when it finishes.
Source: example/ducklake-local.ts
Run the Example
bun run example/ducklake-local.ts
What It Demonstrates
- DuckLake catalog attach via the
ducklakeconfig - Data path configuration for DuckLake tables
- Basic insert and select workflow
Key Snippet
const directory = await mkdtemp(join(tmpdir(), 'drizzle-ducklake-'));
const db = await drizzle(':memory:', {
ducklake: {
catalog: join(directory, 'ducklake.duckdb'),
install: true,
load: true,
attachOptions: {
dataPath: join(directory, 'ducklake-data'),
createIfNotExists: true,
},
},
});