httk.store.db.rows

Batched storage rows with lazy, exact field reconstruction.

Exceptions

StaleResultError

A search result sid disappeared before its lazy row was hydrated.

Classes

RowHydrator

Hydrate a sid sequence in 500-row batches without touching field values yet.

Functions

decode_field(store, schema, spec, sid, row)

Decode one pinned parent-row value.

row_class(cls)

Return the cached lazy subclass for a frozen storable dataclass.

Module Contents

exception httk.store.db.rows.StaleResultError[source]

Bases: RuntimeError

A search result sid disappeared before its lazy row was hydrated.

class httk.store.db.rows.RowHydrator(store, schema_or_cls, sids, *, context=None)[source]

Hydrate a sid sequence in 500-row batches without touching field values yet.

Parameters:
row(sid)[source]

Return the lazy row for sid.

Parameters:

sid (int) – The row identifier.

Returns:

The lazy row proxy.

Raises:

KeyError – If sid is not in this hydrator’s sequence.

Return type:

Any

Database presence is validated when the row’s chunk is loaded or the row is materialized.

materialize_many()[source]

Materialize every row in this batch while retaining recursive chunk batching.

Returns:

The materialized rows in the input order.

Raises:

httk.store.db.rows.StaleResultError – If a requested row no longer exists.

Return type:

tuple[Any, Ellipsis]

materialize(sid)[source]

Materialize and return one row.

Parameters:

sid (int) – The row identifier.

Returns:

The materialized storable instance.

Raises:
Return type:

Any

httk.store.db.rows.decode_field(store, schema, spec, sid, row)[source]

Decode one pinned parent-row value.

Parameters:
Returns:

The decoded field value.

Raises:

TypeError – If the field needs its row chunk for child or reference hydration.

Return type:

Any

httk.store.db.rows.row_class(cls)[source]

Return the cached lazy subclass for a frozen storable dataclass.

Parameters:

cls (type) – The frozen storable dataclass to proxy.

Returns:

The cached lazy row subclass.

Raises:

httk.store.db.schema.SchemaError – If the class uses unsupported slots or custom equality or hashing.

Return type:

type