cdm_data_loaders.converters.cli.xsd_to_pyarrow ¶
CLI interface for generating static Python PyArrow schema modules from XSD schemas.
SchemaCodegenConfig
pydantic-model
¶
Bases: BaseModel
Configuration for generating a component-based PyArrow schema.py module from an XSD file.
Show JSON schema:
{
"description": "Configuration for generating a component-based PyArrow ``schema.py`` module from an XSD file.",
"properties": {
"xsd_file": {
"format": "path",
"title": "Xsd File",
"type": "string"
},
"output": {
"format": "path",
"title": "Output",
"type": "string"
},
"docstring": {
"title": "Docstring",
"type": "string"
},
"xml_level": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": 1,
"title": "Xml Level"
},
"xml_tag": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Xml Tag"
},
"root_tag": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Root Tag"
},
"max_recursion_depth": {
"default": 2,
"title": "Max Recursion Depth",
"type": "integer"
}
},
"required": [
"xsd_file",
"output",
"docstring"
],
"title": "SchemaCodegenConfig",
"type": "object"
}
Config:
frozen:True
Fields:
-
xsd_file(Path) -
output(Path) -
docstring(str) -
xml_level(int | None) -
xml_tag(str | None) -
root_tag(str | None) -
max_recursion_depth(int)
Source code in src/cdm_data_loaders/converters/cli/xsd_to_pyarrow.py
XsdToPyArrowCliSettings ¶
Bases: LoggerSettings
Settings for generating a static Python PyArrow schema module from an XSD file.
Source code in src/cdm_data_loaders/converters/cli/xsd_to_pyarrow.py
render_schema_module ¶
Render a complete, formatted Python schema module from config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SchemaCodegenConfig
|
Code generation configuration. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Formatted Python module source code. |
Source code in src/cdm_data_loaders/converters/cli/xsd_to_pyarrow.py
generate_python_schema ¶
Generate and write a static Python PyArrow schema module from an XSD file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
XsdToPyArrowCliSettings
|
XSD-to-PyArrow CLI settings. |
required |