Skip to main content
DuckDB is a first-class product connector and, at the same time, the engine behind dex’s evals and benchmarks. One adapter, three uses: the zero-credential on-ramp, the dev and CI engine, and the eval and benchmark engine. dex demo supplies the on-ramp’s content, so that first use needs no warehouse of your own.

Auth and target

No credentials. The target is a local DuckDB file (or a directory of Parquet/CSV). Set it in .dex/config.yml:
or pass --path ./warehouse.duckdb on any command. A relative path: in .dex/config.yml resolves against the project root the config lives in, not the shell cwd, so the same file opens whether you run from the project root or a subdirectory (config is found by walking up to the git root). A live --path is typed in your shell, so it stays relative to the current directory.

Read-only and resource bounds

DuckDB is always opened read-only (read_only=True). A read-only open of a nonexistent file fails by design: the adapter attaches to an existing analytical store, it never creates one, and there is no writable fallback to relax. Because the work is free and local, there is no cost ceiling, only resource bounds: a memory limit and a thread cap (defaults: 2GB, 4 threads), overridable from config. The adapter (adapters/duckdb.py) owns all of this. dex demo is the one place a DuckDB file is created, and it is deliberately not the adapter (see the next section).

The demo warehouse

dex demo generates a small e-commerce warehouse locally: 7 tables and 29,512 rows (customers 1,200, products 300, orders 5,000, order_items 14,000, web_events 9,000, warehouse_locations 12, and returns, which an interrupted load left empty), and, beside the dbt project below, a loader’s shipments (168 rows, dated from when the demo ran) and Elementary’s 4 tables in main_elementary (48 rows). No credentials, no cloud account, no network. The path is positional and resolves against --repo-root, which defaults to the working directory, so dex --repo-root R demo writes its files into R and the commands it prints carry the same --repo-root. --path is refused there, because everywhere else it names the warehouse dex reads. A dbt project with an incident in it. Beside the warehouse, demo_project/dbt/ is a dbt project over orders, order_items and shipments: a source, a staging model over each, and a unique and a not_null test on each key. shipments names loaded_at as its dbt loaded_at_field, the time the loader landed each row, and stg_shipments declares shipped_at as its time column with a 12-hour freshness, which renders a dex_freshness test (its macro is copied into macros/). It declares the Elementary package at 0.26.1 and records that release in dbt_packages/elementary/dbt_project.yml, where the resolver reads it. That file is a record, not the package: the demo runs no dbt and installs no package. The demo seeds the history of seven weekly builds of the project, generated by demo/project.py and demo/elementary.py rather than run:
  • Elementary’s tables in main_elementary: dbt_invocations (6 rows) and elementary_test_results (42 rows), built from the reader’s recorded layout, and the layout’s two other tables, test_result_rows and data_monitoring_metrics, empty. The week with the package’s hooks off writes no row, so the coverage timeline reads it as a missed run.
  • The newest build’s manifest and run_results.json in target/, the same invocation as Elementary’s newest run, and the semantic_manifest.json a parse writes, so dex explore semantic list --local reads the semantic layer below.
unique_stg_order_items_order_item_id passes in four builds and fails in the last two, with 956 failures. Those are the order_item_id values the double-loaded batch below repeats, the count a real build of the project reports. And dex_freshness_stg_shipments_shipped_at__43200 passes until the newest build and fails there: the loader landed the four shipments of the twelve hours before that build five minutes after it started, so the build read shipments without them. So dex maintain incidents returns two open incidents from the elementary source, each with the build it was first observed in. dex maintain diagnose names the loader’s duplicate delivery as the first’s cause, over the break from the last passing build to the first failing one, and the late shipments as the second’s (source_arrived_late: all 4 shipments of the twelve hours the test judges landed late, while every shipment of the last passing build’s twelve hours landed in time). A semantic layer that reads the failing column. models/semantic/ holds a dbt semantic layer: the time spine dbt requires (metricflow_time_spine), an orders semantic model on stg_orders with the metrics orders, revenue and average_order_value, and an order_items semantic model on stg_order_items whose primary entity order_item is order_item_id, the failing column. So the diagnosis’s semantic_readers names that entity beside the cause (#1478), and names nothing on orders, whose metrics read none of stg_order_items’ columns. order_items holds no measure: the shop’s order_items has no time column, and MetricFlow gives every measure one. The builds are dated back from when the demo ran, and so are the shipments, unlike every other date here but the project’s source files, dated a day before the oldest build. The incident fold ends an open incident as stale once its source has not observed it for three of its usual gaps, judged against the time it is called, so builds dated from the fixed anchor would read as long over. Weekly builds keep the incident open for about three weeks after dex demo. The pinned digests are taken at a fixed generation time, so the offsets are pinned and only the dates move. explore map leaves the package’s four tables out of the ranking, as it does for a real install. The three staging views and the time spine were never built, so dex maintain verify reports them as no_relation until a build makes them. Run dex transform deps first, then dex transform build --target dev. The order matters: dbt_packages/elementary/ holds only the recorded dbt_project.yml, and the build installs packages only where that directory is missing or empty, so a build on its own would skip dbt deps and run dbt against a package with no code. The project’s files are text, written create-only beside the warehouse, so the generator below stays the one writable DuckDB open; a pinned digest covers them as it covers the rows. Generated, not committed. DuckDB’s storage format has broken backward compatibility across releases before, so a committed file could stop opening for a user on a newer duckdb, and that failure would land on the first command a stranger ever runs. A generator builds against whatever duckdb resolved and cannot rot; it also weighs a few KB in the wheel rather than a binary that does not delta-compress. Deterministic. One pinned seed, a random stream restricted to primitives that are stable across CPython releases, and no wall-clock anywhere: every date is measured back from a fixed anchor. A test pins a sha256 over every generated cell, so a change that would silently move a count quoted in the READMEs fails CI instead. Create-only, and off the connector path. The generator writes a new file and refuses rather than replace one, with no --confirm that can talk past that, and it never creates a parent directory; it will not write a .dex/config.yml where a project at or above the target already has one, so it cannot shadow a real config with its own. It lives in demo/warehouse.py, imports duckdb directly, and reaches neither the adapter nor the SQL guard, so the read-only rule above keeps no branch that could be relaxed. The safety spine asserts that mechanically: one test scans the package for every duckdb.connect( and requires read_only=True everywhere except the generator, another opens a freshly generated file through the adapter and confirms a write is still refused. Seeded to be realistically broken, because a first run that reports a clean bill of health teaches nothing. order_item_id lost its uniqueness to a double-loaded batch; sku mixes numeric and md5-shaped ids from a merged catalogue; web_events.customer_id shares the CRM’s column name and none of its values, so --verify collapses the inferred join at 100% orphans; orders.placed_at is a VARCHAR holding timestamps and web_events.occurred_at a BIGINT holding epoch milliseconds; customers.email and full_name are personal data, while warehouse_locations.city and its coordinates are PII false positives on a building, and site_name is de-rated below the block threshold by its own values. generate_demo_warehouse is exported from the package, so the Python API and examples/quickstart.py build the same fixture.

Exact distinct counts

Profiling reads distinct counts approximately (approx_count_distinct) for scale, but the adapter also exposes exact_distinct_counts(identifier, columns): one batched, read-only COUNT(DISTINCT ...) that the engine calls to escalate the few columns sitting near unique, so a real key is never lost to approximation error. The escalation policy lives in the engine, not the adapter; the adapter only answers the exact query it is asked for (an empty column list runs nothing).

Dev-target seeding convention

transform build runs against the dev target with cwd pinned to the project dir, so a relative path: in profiles.yml resolves to a database inside the project, never a stray file at the caller’s shell cwd. If that dev DuckDB file does not yet exist and the project reads from sources, build refuses with an actionable message rather than letting dbt create an empty database: seed the dev target first (copy the shared source warehouse, or point the dev path: at an existing file). A source-less project is allowed to create its dev database on first build, with a warning. transform build --verify is free here. A relation whose row count the catalog does not keep gets a real COUNT(*) instead of an estimate, because counting bills nothing and a verdict about a ten percent difference has no business resting on a catalog figure, so every finding comes back exact: true. That matters more than it sounds: dbt-duckdb materializes as a view by default and DuckDB keeps no row count for a view, so a sweep that trusted metadata alone would judge nothing in a default project. There is no dev-namespace fold to make either, since the dev target is a database file and the dev-target preflight already refuses a build whose profile and config disagree about which one. transform test --mutate is free here too, and it is the connector to learn the command on: every mutant is a full dbt run, so twenty of them against a local file cost nothing but a few seconds, and no handshake stands between the caller and the answer. Nothing is materialized either way, because a mutant builds as an ephemeral model, so the dev database holds exactly the relations it held before. Each survivor is also compared with the unmutated model on the dev data, free and unasked here: one aggregate dbt show per survivor, plus one self-check of the unmutated model against itself, labels it equivalent or distinguishable. --no-check-equivalence turns that off. The tests of the models downstream of the mutated one run against each mutant too, unasked here because it is free: each downstream model is made ephemeral in the same copy, so dbt inlines the chain, mutant at the bottom, into each of its tests. A defect only those tests caught is caught_downstream, and score still counts it as a miss for the model’s own suite. --no-downstream turns that off. The dev target being the source file is also why transform init’s content preflight skips DuckDB’s base namespace: “the file already holds objects” is true of every working setup, so warning on it would only teach users to skim. With --layered-schemas the layer schemas inside the file (staging_dev, intermediate_dev, marts_dev on the dev target) are genuinely dbt-owned, and those are checked and warned about when populated.

Capabilities probe

returns an envelope whose data reports connector, dialect, read_only: true, paradigm: free_local, the engine version, and the resource bounds.

Why it anchors v0.1

The full Explore, Transform, Maintain loop is built and proven on DuckDB first, with no cloud accounts, fully deterministic in CI. The cloud connectors and their cost paradigms layer onto the proven loop at v0.2. It also matches ADE-bench’s DuckDB mode and Spider2.0-DBT’s dbt engine, so the test engine and the benchmark engine are the same engine. Source: references/duckdb.md (edit on main). This page is generated; change the source, not the site.