httk-store¶
This site documents specifically the httk-store module. For the full documentation of httk₂ as a whole, see docs.httk.org.
httk-store is a httk₂ module for data
management. It is the capability layer built on the stdlib-only contracts
and models in httk-core: it serves httk-core’s record models through the
neutral httk.core.EntryProvider contract, validates values against their
OPTIMADE property definitions with jsonschema, and provides the database
storage layer httk.store.backend.sql — relational storage and querying of plain frozen
dataclasses over SQLite, DuckDB, or PostgreSQL (via the httk-store[db] /
httk-store[duckdb] / httk-store[postgresql] extras).
The httk-store[mongodb] extra provides MongoDB storage through the same neutral
contracts. ClickHouse supports bulk ingestion and read serving via
httk-store[clickhouse,parallel], subject to the
documented write restrictions.
Quick links
Data management guide: Data management
Backend storage guide: Backend storage
MongoDB storage guide: MongoDB storage
Federated stores guide: Federated stores
Migrating from httk v1: Migrating from httk v1
API reference: Reference
Runnable examples: Examples
Examples notebook: Examples
The topic pages above are short and practical; the ones with a full guide link onward to it in the Details section of the sidebar.
Install¶
Use Python 3.12 or newer in a virtual environment, then install from PyPI:
python -m pip install "httk-store==2.1.0"
For a source checkout:
git clone https://github.com/httk/httk-store
cd httk-store
python -m pip install -e .
Usage example¶
from httk.core import standard_entry_type
from httk.store import ReferenceEntryProvider, validate_record
# Serve a bibliographic reference through the entry-provider contract.
provider = ReferenceEntryProvider({"ref-1": {"title": "A study", "year": "2021"}})
assert list(provider.entry_types()) == ["references"]
# Validate an OPTIMADE 'references' record against its vendored definition.
validate_record(
standard_entry_type("references"),
{"id": "ref-1", "type": "references", "title": "A study", "year": "2021"},
)