Skip to main content

DuckDB

Zero-config local analytics engine. db_type is duckdb. Supports local file databases, in-memory (:memory:), and MotherDuck cloud (md: URLs). Tier 3.

Connection config

duckdb
{
"name": "local-duckdb",
"db_type": "duckdb",
"database": "/path/to/warehouse.duckdb"
}

MotherDuck:

motherduck
{
"name": "motherduck",
"db_type": "duckdb",
"database": "md:my_database",
"motherduck_token": "..."
}

Connection fields

FieldRequiredDescription
nameYesConnection name. [a-zA-Z0-9_-], max 64 chars.
db_typeYesduckdb.
databaseYesFile path to the .duckdb file, :memory:, or a md: MotherDuck URL.
motherduck_tokenNoMotherDuck personal access token. Required for md: connections.
query_timeoutNoSeconds, 1–3600.

Capabilities

CapabilitySupportedNotes
QueryYesFile-based DBs open a transient read-only connection per query, so the gateway never holds a write lock that would block dbt. In-memory DBs use a persistent connection.
Schema introspectionYes (full)information_schema for columns/tables, duckdb_tables() / duckdb_columns() for comments and estimated sizes.
FK discoveryYesVia information_schema table constraints.
EXPLAINYesSupported.
Cost estimationNoNot byte-billed.
Schema statsYesEstimated row count from duckdb_tables().estimated_size; table and column comments.

Tier 3.

Dialect notes / gotchas

  • Identifiers are quoted with double quotes ("col").
  • Integer division truncates.
  • INTERVAL syntax requires quotes.
  • DATE_TRUNC returns a TIMESTAMP.
  • File-based connections are opened read-only per query; dbt can take the write lock between MCP queries.

Blocked functions

These DuckDB functions are blocked inside SELECT (plus all DDL/DML):

  • File system: read_csv, read_csv_auto, read_parquet, read_json, read_json_auto, read_blob, read_text
  • Network: httpfs_get, http_get, http_post
  • Cross-engine scanning: postgres_scan, sqlite_scan, mysql_scan, iceberg_scan, delta_scan
  • Extension loading: load_extension, install_extension

The universal load_extension / install_extension block also applies.

duckdb-sql — covers DuckDB-specific patterns and gotchas that differ from PostgreSQL/MySQL.

Cloud vs local

DuckDB is a local connector: the gateway needs filesystem access to the .duckdb file. MotherDuck (md: URLs with a motherduck_token) provides a cloud-hosted DuckDB. When the sandbox service is enabled (SP_SANDBOX_ENABLED=true) in local mode, DuckDB runs through the sandboxed connector.