Records⚓︎
records
⚓︎
Lightweight typed records produced from table schemas.
Schema records are created after table shape validation, field parsing, and
source metadata collection. They behave like small dataclass-style objects
without requiring schema classes to define __init__ methods.
Info
Output-model conversion happens after records are finalized. Use
parse() when tests need these source-aware record objects.
TableRecord
⚓︎
Base record object created before optional model conversion.
Attributes:
-
table_source(RecordSource) –Immutable source metadata for the record.
-
table_extras(Mapping[str, Any]) –Preserved inapplicable variant values when schema policy allows them.
Warning
Users normally subclass RowTable or ColumnTable rather than
TableRecord directly.
table_source
property
⚓︎
table_source: RecordSource
Return immutable source metadata for this parsed record.
Returns:
-
RecordSource–RecordSourcecontaining record and field cell locations.
Info
Source metadata remains available even when validation later raises an error, making custom diagnostics easier to build.
table_extras
property
⚓︎
_from_values
classmethod
⚓︎
_from_values(
values: dict[str, Any],
*,
source: RecordSource | None = None,
extras: Mapping[str, Any] | None = None,
) -> TableRecord
Construct a schema record without invoking user initialization.
Parameters:
-
values(dict[str, Any]) –Parsed values keyed by schema attribute name.
-
source(RecordSource | None, default:None) –Optional source metadata for the record.
-
extras(Mapping[str, Any] | None, default:None) –Optional preserved extra values.
Returns:
-
TableRecord–A populated record instance of
cls.
Info
Schema classes declare fields as descriptors, so direct assignment
through setattr attaches values consistently with normal
attribute access.
source_for
⚓︎
as_dict
⚓︎
__repr__
⚓︎
__repr__() -> str
Return a constructor-like representation of declared fields.
Returns:
-
str–String containing the record type and parsed field values.
Info
The representation is meant for tests and debugging, not for round-tripping records.
__eq__
⚓︎
Compare records by concrete type and declared field values.
Parameters:
-
other(object) –Object being compared to this record.
Returns:
-
bool–Truewhen both records have the same concrete schema type and -
bool–parsed field dictionary.
Warning
Source metadata and preserved extras do not participate in equality. They describe provenance rather than record identity.