cdm_data_loaders.converters.emitters.pyarrow_codegen ¶
Render static Python schema modules from converter IR documents and PyArrow types.
render_scalar_type_expr ¶
Render a scalar PyArrow DataType as a Python constructor expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtype
|
DataType
|
Scalar PyArrow data type. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Python constructor expression string. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If |
Source code in src/cdm_data_loaders/converters/emitters/pyarrow_codegen.py
render_python_schema_module ¶
render_python_schema_module(
emitter: PyArrowEmitter,
document: SchemaDocument | Mapping[str, SchemaDocument],
*,
docstring: str | None = None
) -> str
Render a complete, formatted Python schema module from one or more SchemaDocument instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emitter
|
PyArrowEmitter
|
|
required |
document
|
SchemaDocument | Mapping[str, SchemaDocument]
|
A single |
required |
docstring
|
str | None
|
Optional module docstring header. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted Python module source code defining |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/cdm_data_loaders/converters/emitters/pyarrow_codegen.py
write_python_schema_file ¶
write_python_schema_file(
emitter: PyArrowEmitter,
document: SchemaDocument | Mapping[str, SchemaDocument],
output: str | Path,
*,
docstring: str | None = None
) -> Path
Render and write a static Python schema module to output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emitter
|
PyArrowEmitter
|
|
required |
document
|
SchemaDocument | Mapping[str, SchemaDocument]
|
A single |
required |
output
|
str | Path
|
Destination file path for the generated Python module. |
required |
docstring
|
str | None
|
Optional module docstring header. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved output |