aeat.application.export._tabular module

Serialize tabular rows into TabularExportResult payloads.

Rows are rendered through the closed ExportSerializationFormat surface, with ExportFieldError and ExportFormatError preserving validation failures as structured application errors.

This module is a pure in-memory serializer. It returns bytes, media type, extension, field metadata, row count, and SHA-256 digest to the calling export service; it does not choose paths, write files, emit bucket events, or mutate canonical storage.

class ExportSerializationFormat(*values)[source]

Bases: StrEnum

Closed set of backend tabular export serialization formats.

CSV
JSONL
XLSX
class TabularExportResult(**data)[source]

Bases: BaseModel

Serialized tabular payload produced by serialize_tabular_rows().

The result carries the raw payload plus operator-facing metadata: ExportSerializationFormat, media type, filename extension, byte count, SHA-256 digest, row count, and normalized field names.

Parameters:
format: ExportSerializationFormat
media_type: str
filename_extension: str
payload: bytes
byte_size: int
sha256: str
row_count: int
fieldnames: tuple[str, ...]
serialize_tabular_rows(rows, *, fieldnames, export_format)[source]

Serialize string-keyed rows as deterministic CSV, JSON Lines, or XLSX.

Field order follows fieldnames and row order follows rows. Values are coerced to strings, missing fields become empty strings, and unknown fields raise ExportFieldError. Returns a TabularExportResult with encoded bytes, media type, filename extension, row count, field metadata, and payload digest.

Return type:

TabularExportResult

Parameters: