extract_component_ids()

Retrieve all component IDs from a given pysdmx Schema.

Usage

Source

extract_component_ids(schema)

Parameters

schema: Schema
A pysdmx Schema object representing an SDMX structure.

Returns

list[str]
A list of component IDs contained in the schema.

Raises

TypeError

If the input is not a Schema instance.

ValueError
If the schema has no components.

Examples

>>> from pysdmx.model import Schema, Components, Component
>>> comp1 = Component(id="FREQ")
>>> comp2 = Component(id="TIME_PERIOD")
>>> schema = Schema(context="datastructure", agency="ECB", id_="EXR",
...                 components=Components([comp1, comp2]),
...                 version="1.0.0", urns=[])
>>> extract_component_ids(schema)
['FREQ', 'TIME_PERIOD']