SDMX Schemas Python Wrapper

raw JSON →
1.0.0 verified Mon Apr 27 auth: no python

sdmxschemas is a Python package providing the SDMX (Statistical Data and Metadata eXchange) schemas as a Python module for validation and reference. Version 1.0.0 supports SDMX 3.1 schemas. It is a thin wrapper over the official SDMX XSD and JSON schemas, enabling programmatic access to schema locations and content.

pip install sdmxschemas
error ModuleNotFoundError: No module named 'sdmxschemas'
cause Package not installed or virtual environment not activated.
fix
Run 'pip install sdmxschemas' in the correct environment.
error KeyError: '3.1'
cause Requested version not available or misspelled.
fix
Check available versions with SDMXSchema('').versions or use '3.1' exactly.
gotcha Version string must match exactly (e.g., '3.1', not '3.1.0' or 'v3.1').
fix Use the version as defined by SDMX, e.g., '3.1' for SDMX 3.1.
deprecated Some older SDMX versions may be removed in future releases.
fix Always pin your dependency and check changelog for schema version removals.
gotcha Schema paths are platform-dependent; avoid hardcoding the package directory.
fix Use SDMXSchema class methods instead of accessing __file__ or similar.

Initialize SDMXSchema with a version string and explore available schemas.

from sdmxschemas import SDMXSchema

# Access schema version 3.1
schema = SDMXSchema('3.1')
print(schema.versions)  # list available versions
print(schema.get_schema_names())  # list available schema files