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.db — relational storage and querying of plain frozen dataclasses over SQLite or DuckDB (via the httk-store[db] / httk-store[duckdb] extras).

Quick links

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

Preferably work in a Python virtual environment, then do:

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"},
)