Skip to content

DuckDB

DuckDB database files: the duckdb source, from the duckdb package. Declare the package once in dependencies.yml; DRE installs it on demand:

dependencies.yml
plugins:
- duckdb

Set in profiles.yml, under connections:, in a target with type: duckdb.

Field Default Notes
path :memory: DuckDB database file (relative to the project), or :memory:.
threads Number of threads DuckDB may use.
memory_limit DuckDB memory limit, e.g. 4GB.
Field Notes
path Database file, relative to the project directory. Default :memory:.
threads, memory_limit Passed to DuckDB.

Capabilities: sessions, read_only, check (via EXPLAIN).

Use DuckDB for local examples, SQL over files and reproducible report tests. A memory database exists for one connection session; use a file path for tables that must survive runs.

profiles.yml
connections:
warehouse:
targets:
dev: {type: duckdb, path: ":memory:"}
dre_project.yml
name: local_reports
default_profile: warehouse
-- reports/check/check.sql
select 'local' as environment, 42 as row_count
# reports/check/check.yml; also declare csv in dependencies.yml
queries: [check]
output: {format: csv}

dre run check --preview 5 writes a local sample. The complete tutorial project includes dependencies and every file. For a real file-backed report, set path: reporting.duckdb relative to the project root. threads controls DuckDB work as well as Binding concurrency; memory_limit: 1GB bounds DuckDB’s memory, not the xlsx writer’s memory.

connection-failed can mean another process holds the database file; close its writer and retry. query-failed on a missing table in :memory: means this session has not created or loaded it. Put setup SQL before the result query, using tab: false. See connections, report keys, error codes, and source plugin.