pyxsd.integrations.arrow

Explicit Arrow record schemas, tables and row-batched Parquet output.

Install pyxsd[arrow]. The input XML tree and record selection are materialized; output batching is not streaming XML parsing.

Classes

RecordProjection

A fixed declaration-specific schema; rows never determine column types.

Functions

records(schema, *, element[, path, columns])

Prepare an explicit global/local record projection before any rows exist.

Module Contents

class pyxsd.integrations.arrow.RecordProjection(schema, *, element, path=(), columns=None)

A fixed declaration-specific schema; rows never determine column types.

Parameters:
schema
dataset_metadata()

Return this projection’s historical XSD manifest fields unchanged.

Return type:

dict[str, Any]

batches(document, *, selector=None, namespaces=None, batch_size=10000, revalidate=False)

Yield bounded row batches, not XML streaming; keep input stable until closed.

Parameters:
Return type:

collections.abc.Iterator[Any]

table(document, *, selector=None, namespaces=None, revalidate=False)

Materialize the selected rows, including a fully typed empty table.

Parameters:
Return type:

Any

write_dataset(sources, destination, *, selector=None, namespaces=None, batch_size=10000, errors='raise')

Publish a new local manifested dataset, never append or overwrite.

Parse inputs sequentially with this projection’s compiled schema. Report mode skips expected input/projection failures, not output/internal faults. Keep sources stable; batching bounds output rows, not XML tree memory. The destination parent must exist and have a single writer.

Parameters:
Return type:

pyxsd.integrations.dataset.DatasetResult

write_parquet(document, destination, *, selector=None, namespaces=None, batch_size=10000, revalidate=False)

Atomically replace local paths; borrowed sinks may retain partial output.

Parameters:
Return type:

None

pyxsd.integrations.arrow.records(schema, *, element, path=(), columns=None)

Prepare an explicit global/local record projection before any rows exist.

Parameters:
Return type:

RecordProjection | pyxsd.relaxng.records.RelaxNGRecordProjection