Skip to content

DuckDBConnection

relationalai.config.connections.duckdb

Configure a DuckDB connection.

Use this when you want to run PyRel against DuckDB (either a file-backed database or ":memory:"). The underlying DuckDBPyConnection is created by DuckDBConnection.get_session and cached on the instance.

>>> from relationalai.config import Config, DuckDBConnection
>>> cfg = Config(connections={"local": DuckDBConnection(path=":memory:")}, default_connection="local")
>>> conn = cfg.get_session(DuckDBConnection)
DuckDBConnection.path: str

Path to the DuckDB database file, or ":memory:" for an in-memory database.

DuckDBConnection.read_only: (bool, optional)

Whether to open the database in read-only mode.

DuckDBConnection.config: (dict[str, Any], optional)

Extra DuckDB connection options passed through to duckdb.connect.

DuckDBConnectionBaseConnectionpydantic.BaseModelabc.ABC
 config
├──  config
│   └──  Config
│       └──  get_session
└──  connections
    └──  ConnectionConfig