httk.store.db.results¶
Lazy, named result rows for SqlSearcher.
Exceptions¶
Report that a result-set |
|
Report that a result-set |
|
A cursor proxy was used after the cursor advanced. |
Classes¶
Represent one named result row by position, name, or attribute. |
|
A declared scalar projection, with exact and float presentations. |
|
A frozen, lazy result plan. |
Module Contents¶
- exception httk.store.db.results.MultipleResultsError[source]¶
Bases:
LookupErrorReport that a result-set
one()operation found multiple results.
- exception httk.store.db.results.NoResultError[source]¶
Bases:
LookupErrorReport that a result-set
one()operation found no matching result.
- class httk.store.db.results.ResultRow(values, names, resolver=None, guard=None)[source]¶
Represent one named result row by position, name, or attribute.
- Parameters:
- exception httk.store.db.results.ExpiredCursorRowError[source]¶
Bases:
RuntimeErrorA cursor proxy was used after the cursor advanced.
- class httk.store.db.results.ResultColumn(result, index)[source]¶
A declared scalar projection, with exact and float presentations.
- Parameters:
result (SqlResultSet) – The result set containing the projection.
index (int) – The projection’s position in the result set.
- floats()[source]¶
Yield the query-domain values for this projection.
- Yield:
A projection value in the query-domain representation.
- class httk.store.db.results.SqlResultSet(searcher, outputs=None)[source]¶
A frozen, lazy result plan.
- Parameters:
searcher (httk.store.db.searcher.SqlSearcher) – The search whose query state is frozen.
outputs (dict[str, Any] | None) – Optional output names mapped to query variables or columns.
- property names: tuple[str, Ellipsis][source]¶
Return the names of the declared projections in order.
- first()[source]¶
Return the first result, or
Nonewhen no result exists.- Returns:
The first result row, if present.
- Return type:
httk.store.query.ResultRow | None
- one()[source]¶
Return the only result.
- Returns:
The sole result row.
- Raises:
NoResultError – If no result exists.
MultipleResultsError – If more than one result exists.
- Return type:
- scalars(name=None)[source]¶
Yield one projection from each result row.
- Parameters:
name (str | None) – The projection name, required when several projections are declared.
- Returns:
An iterator over the selected projection values.
- Raises:
ValueError – If
nameis omitted while several projections are declared.KeyError – If
nameis not a declared projection.
- Return type:
- column(name)[source]¶
Return a scalar projection by name.
- Parameters:
name (str) – The declared scalar projection name.
- Returns:
The selected result column.
- Raises:
- Return type:
- page(*, size, order_by, cursor=None, include_total=False)[source]¶
Fetch one bounded, live keyset page of this frozen SQL result plan.
Paging is intentionally separate from
cursor(): this method returns independent rows whose page-local hydration state remains alive through their result-row resolvers, whilecursor()returns reusable proxies that expire on advance. It performs oneLIMIT size + 1match query and never materializes this result set’s ordinary match cache. A total is deliberately opt-in because it requires the normal exact count query.- Parameters:
size (int) – The maximum number of rows in the page.
order_by (collections.abc.Iterable[httk.store.query.PageOrder]) – The declared scalar projections used for keyset ordering.
cursor (httk.store.query.ContinuationToken | None) – The continuation token identifying the page position.
include_total (bool) – Whether to include the exact filtered total.
- Returns:
The requested result page.
- Raises:
UnsupportedQueryError – If the query or ordering is not pageable.
- Return type: