httk.store.backend.duckdb.engine

DuckDB database construction for Backend.

Functions

database(cls[, path, memory_limit, read_only])

Build a DuckDB-backed backend stored in path, or in memory when path is None.

Module Contents

httk.store.backend.duckdb.engine.database(cls, path=None, *, memory_limit=None, read_only=False)

Build a DuckDB-backed backend stored in path, or in memory when path is None.

Parameters:
  • cls (type[Backend]) – The backend class to instantiate.

  • path (str | os.PathLike[str] | None) – The database file path, or None for an in-memory database.

  • memory_limit (str | None) – An optional DuckDB memory_limit setting such as "1GB". DuckDB’s own default allows every instance up to about 80% of system RAM, which multiplies dangerously across parallel test or ingest processes; when this parameter is None the HTTK_DUCKDB_MEMORY_LIMIT environment variable (if set) supplies the cap instead, so process trees can be memory-guarded wholesale.

  • read_only (bool) – Open the file in DuckDB READ_ONLY access mode. A read-only database takes no write lock, so several processes (and this one) may open the same file concurrently for reading; write operations on the resulting backend will fail. Ignored for the in-memory database.

Returns:

The configured backend wrapper.

Raises:

ImportError – If the duckdb_engine SQLAlchemy dialect is not installed; install the httk-store[duckdb] extra to use it.

Return type:

httk.store.backend.sql.engine.Backend