DuckDB
DuckDB Data Connector Documentation
DuckDB is an in-process SQL OLAP (Online Analytical Processing) database management system designed for analytical query workloads. It is optimized for fast execution and can be embedded directly into applications, providing efficient data processing without the need for a separate database server.
This connector supports DuckDB persistent databases as a data source for federated SQL queries.
Configuration
from
from
The from
field supports one of two forms:
from
Description
duckdb:database.schema.table
Read data from a table named database.schema.table
in the DuckDB file
duckdb:*
name
name
The dataset name. This will be used as the table name within Spice.
Example:
params
params
The DuckDB data connector can be configured by providing the following params
:
duckdb_open
The name of the DuckDB database to open.
Configuration params
are provided either in the top level dataset
for a dataset source, or in the acceleration
section for a data store.
Examples
Reading from a relative path
A generic example of DuckDB data connector configuration.
Reading from an absolute path
DuckDB Functions
Common data import DuckDB functions can also define datasets. Instead of a fixed table reference (e.g. database.schema.table
), a DuckDB function is provided in the from:
key. For example
Datasets created from DuckDB functions are similar to a standard SELECT
query. For example:
is equivalent to:
Many DuckDB data imports can be rewritten as DuckDB functions, making them usable as Spice datasets. For example:
Limitations
The DuckDB connector does not support enum, dictionary, or map field types. For example:
Unsupported:
SELECT MAP(['key1', 'key2', 'key3'], [10, 20, 30])
The DuckDB connector does not support
Decimal256
(76 digits), as it exceeds DuckDB's maximum Decimal width of 38 digits.
Last updated
Was this helpful?