Backend storage in detail¶
httk.store.backend.sql is the database storage layer of httk₂: it stores plain
frozen dataclasses in a relational database, makes them queryable through a
backend-agnostic search DSL, and serves them through the neutral
httk.core.EntryProvider contract (e.g. as an OPTIMADE API via
httk-serve). SQL generation and dialect handling run on SQLAlchemy Core
internally; the public API exposes no SQLAlchemy types.
Installing¶
The SQL layer is an optional extra (plain import httk.store works without it):
python -m pip install "httk-store[db]" # SQLite (built into Python) via sqlalchemy
python -m pip install "httk-store[duckdb]" # additionally the DuckDB backend
python -m pip install "httk-store[postgresql]" # PostgreSQL backend (psycopg 3)
python -m pip install "httk-store[clickhouse]" # ClickHouse backend
Backend.postgresql(url) opens a PostgreSQL store from a postgresql:// URL.
It is fully transactional and rides the ordinary transactional write profile
with no special-casing, and it supports bulk ingestion (store.bulk_ingest())
with the same parity/deferred/parallel behavior as SQLite and DuckDB. Only the
psycopg 3 driver is supported: a bare postgresql:// URL is normalized to
postgresql+psycopg:// and any other explicit driver is rejected. See the
PostgreSQL testing guide for local setup.
Touching a SQL-backed name (such as httk.store.backend.sql.Backend) without the extra
installed raises an ImportError naming it.
Topics¶
Previous section links¶
The sections of this guide now have their own pages. Existing section links land here; follow the matching link to the full discussion.