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¶
A fixed declaration-specific schema; rows never determine column types. |
Functions¶
|
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 (pyxsd.schema.Schema)
element (str)
columns (collections.abc.Mapping[str, pyxsd.integrations.projection.FieldSource] | None)
- schema¶
- dataset_metadata()¶
Return this projection’s historical XSD manifest fields unchanged.
- 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:
- table(document, *, selector=None, namespaces=None, revalidate=False)¶
Materialize the selected rows, including a fully typed empty table.
- 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:
sources (collections.abc.Iterable[pyxsd.batch.DocumentSource])
destination (str | os.PathLike[str])
selector (str | None)
batch_size (int)
errors (Literal['raise', 'report'])
- Return type:
- write_parquet(document, destination, *, selector=None, namespaces=None, batch_size=10000, revalidate=False)¶
Atomically replace local paths; borrowed sinks may retain partial output.
- pyxsd.integrations.arrow.records(schema, *, element, path=(), columns=None)¶
Prepare an explicit global/local record projection before any rows exist.
- Parameters:
schema (pyxsd.schema.Schema | pyxsd.relaxng.schema.RelaxNGSchema)
element (str)
columns (collections.abc.Mapping[str, pyxsd.integrations.projection.FieldSource] | None)
- Return type:
RecordProjection | pyxsd.relaxng.records.RelaxNGRecordProjection