httk.store.backend.duckdb.engine¶
DuckDB database construction for Backend.
Functions¶
|
Build a DuckDB-backed backend stored in |
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 whenpathis None.- Parameters:
path (str | os.PathLike[str] | None) – The database file path, or
Nonefor an in-memory database.memory_limit (str | None) – An optional DuckDB
memory_limitsetting 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 isNonetheHTTK_DUCKDB_MEMORY_LIMITenvironment variable (if set) supplies the cap instead, so process trees can be memory-guarded wholesale.read_only (bool) – Open the file in DuckDB
READ_ONLYaccess 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_engineSQLAlchemy dialect is not installed; install thehttk-store[duckdb]extra to use it.- Return type: