betty.porters.record_mapping module¶
Porters for records as mappings.
- final class betty.porters.record_mapping.RecordMappingPorter¶
Bases:
RecordPorter[DataClsT,Element[str]],GenericLoad and dump a record from and to portable mappings.
- __init__(record: RecordDefinition[DataClsT, ElementT], /)¶
- dump(data: DataClsT, /) PortableMapping¶
Dump data to its portable form.
- dump_key(data: DataClsT, key: ElementT, /) tuple[str, PortableData]¶
Dump the data to portable data and a portable primary key.
- load(portable: PortableData, /) DataClsT¶
Load data from its portable form.
- load_key(portable: PortableData, key: ElementT, portable_key: str, /) DataClsT¶
Create a new data instance from portable data and a portable primary key.
- Raises:
betty.exception.HumanFacingException – Raised if the portable data is invalid.