sdmxlib 0.75.0__tar.gz → 0.76.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/PKG-INFO +9 -1
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/README.md +8 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/pyproject.toml +3 -1
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/pyproject.toml.orig +5 -1
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/__init__.py +2 -1
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/federated.py +9 -7
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/registry.py +40 -15
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/session.py +26 -3
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/builders/contentconstraint.py +56 -6
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/__init__.py +5 -1
- sdmxlib-0.76.2/src/sdmxlib/bundle/_build.py +330 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_check.py +70 -4
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_fetch.py +30 -43
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_fingerprint.py +19 -6
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_write.py +30 -44
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/manifest.schema.json +12 -1
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/local/data_store.py +90 -57
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/local/registry.py +16 -13
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/local/sql.py +64 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/binding.py +0 -25
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/codelist.py +67 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/in_memory_registry.py +5 -1
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_compile.py +185 -30
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_expr.py +9 -1
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_joins.py +27 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/accessors.py +3 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/observations.py +69 -10
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_manifest.py +9 -3
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/lazy.py +44 -3
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/readers.py +20 -20
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/resolve.py +33 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/schema.py +10 -5
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/writers.py +16 -5
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/LICENSE +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/_duckdb.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/_singleflight.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/_time.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/_freshness.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/client.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/policy.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/api/providers.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/builders/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/builders/metadata_annotation.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_availability.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_canonical.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_copy.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_finding.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_overlay.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/_remote.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/bundle/overlay.schema.json +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/data_store.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/_arrow.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/_attachment.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/_coerce.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/_index.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/_positions.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/_refuse.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/data_format.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/gaps.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/render.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_data_common.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/local/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/local/_scan.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/local/engine.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/local/object_store.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_binding.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_container.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_invariants.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_items.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_label_match.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_rebind.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_referenceable.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_refshape.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_resolvers.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_rules.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/_tree.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/annotations.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/base.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/category.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/collections.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/concept.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/constraint.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/convert.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/dataflow.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/datastructure.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/errors.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/expr.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/header.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/hierarchy.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/istring.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/link.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/mapping.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/message.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/metadata_provision.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/metadataflow.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/metadataset.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/metadatastructure.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/organisation.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/provision.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/ref.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/registry.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/representation.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/rest_api.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/rollup.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/urn.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/validation.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/valuelist.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/version.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/model/version_rewrite.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/polars.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/py.typed +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_closure.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_common.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_edges.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_execute.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_plan.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_pushdown.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_rebase.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/_rest.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/query.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/raw.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/query/schema.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/rest.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/session.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/sql.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/__init__.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_checked.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_columns.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_kinds.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_parsed.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_projections.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_references.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_synthetic.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/storage/_trim.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/testing.py +0 -0
- {sdmxlib-0.75.0 → sdmxlib-0.76.2}/src/sdmxlib/versions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sdmxlib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.76.2
|
|
4
4
|
Summary: SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store.
|
|
5
5
|
Keywords: sdmx,statistics,metadata,datastructure
|
|
6
6
|
Author: gabrielgellner
|
|
@@ -36,6 +36,7 @@ Description-Content-Type: text/markdown
|
|
|
36
36
|
[](https://pypi.org/project/sdmxlib/)
|
|
37
37
|
[](LICENSE)
|
|
38
38
|
[](https://statcat-suite.github.io/sdmxlib/)
|
|
39
|
+
[](https://scorecard.dev/viewer/?uri=github.com/StatCat-Suite/sdmxlib)
|
|
39
40
|
[](https://github.com/astral-sh/uv)
|
|
40
41
|
[](https://github.com/astral-sh/ruff)
|
|
41
42
|
|
|
@@ -165,3 +166,10 @@ Issues are tracked on [GitHub](https://github.com/StatCat-Suite/sdmxlib/issues).
|
|
|
165
166
|
The project started on GitLab, so a bare `#492` in code, comments or docs means
|
|
166
167
|
an issue in the [GitLab tracker](https://gitlab.com/pinax-suite/sdmxlib/-/issues),
|
|
167
168
|
which stays readable as an archive. GitHub issues are written `GH-12`.
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) says how to propose a change, and everyone
|
|
173
|
+
taking part follows the [Code of Conduct](CODE_OF_CONDUCT.md). Report a
|
|
174
|
+
security issue privately, as [SECURITY.md](SECURITY.md) describes, and never
|
|
175
|
+
in a public issue.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
[](https://pypi.org/project/sdmxlib/)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://statcat-suite.github.io/sdmxlib/)
|
|
7
|
+
[](https://scorecard.dev/viewer/?uri=github.com/StatCat-Suite/sdmxlib)
|
|
7
8
|
[](https://github.com/astral-sh/uv)
|
|
8
9
|
[](https://github.com/astral-sh/ruff)
|
|
9
10
|
|
|
@@ -133,3 +134,10 @@ Issues are tracked on [GitHub](https://github.com/StatCat-Suite/sdmxlib/issues).
|
|
|
133
134
|
The project started on GitLab, so a bare `#492` in code, comments or docs means
|
|
134
135
|
an issue in the [GitLab tracker](https://gitlab.com/pinax-suite/sdmxlib/-/issues),
|
|
135
136
|
which stays readable as an archive. GitHub issues are written `GH-12`.
|
|
137
|
+
|
|
138
|
+
## Contributing
|
|
139
|
+
|
|
140
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) says how to propose a change, and everyone
|
|
141
|
+
taking part follows the [Code of Conduct](CODE_OF_CONDUCT.md). Report a
|
|
142
|
+
security issue privately, as [SECURITY.md](SECURITY.md) describes, and never
|
|
143
|
+
in a public issue.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sdmxlib"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.76.2"
|
|
4
4
|
description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -127,6 +127,8 @@ dev = [
|
|
|
127
127
|
"pydoclint>=0.11.1,<0.12",
|
|
128
128
|
"pyrefly>=1.4.0,<1.5",
|
|
129
129
|
"ruff>=0.17.1,<0.18",
|
|
130
|
+
"pip-audit>=2.10.1,<2.11",
|
|
131
|
+
"zizmor>=1.31.1,<1.32",
|
|
130
132
|
"mutmut>=3.8,<4",
|
|
131
133
|
"hypothesis>=6.140,<7",
|
|
132
134
|
"sqlglot>=27.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sdmxlib"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.76.2"
|
|
4
4
|
description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -149,6 +149,10 @@ dev = [
|
|
|
149
149
|
"pydoclint>=0.11.1,<0.12",
|
|
150
150
|
"pyrefly>=1.4.0,<1.5",
|
|
151
151
|
"ruff>=0.17.1,<0.18",
|
|
152
|
+
# Security checks (GH-220): `just audit` and `just lint-workflows`. Upper
|
|
153
|
+
# bounds for the same reason as the checkers above.
|
|
154
|
+
"pip-audit>=2.10.1,<2.11",
|
|
155
|
+
"zizmor>=1.31.1,<1.32",
|
|
152
156
|
# 3.8: `process_isolation = "forkserver"`, which `tools/mutmut_forksafe.py`
|
|
153
157
|
# builds on, and the `state()` its import-time credit reads.
|
|
154
158
|
"mutmut>=3.8,<4",
|
|
@@ -10,7 +10,7 @@ from sdmxlib.api.providers import Provider
|
|
|
10
10
|
from sdmxlib.formats.data_format import DataFormat
|
|
11
11
|
from sdmxlib.formats.gaps import DroppedArtefact, Gap, dropped, unrepresentable
|
|
12
12
|
from sdmxlib.api.client import ResponseTooLargeError
|
|
13
|
-
from sdmxlib.api.registry import BearerToken, FmrRegistry, RestRegistry
|
|
13
|
+
from sdmxlib.api.registry import BearerToken, FmrRegistry, Resolve, RestRegistry
|
|
14
14
|
from sdmxlib.data_store import DataStore, WriteSource
|
|
15
15
|
from sdmxlib.model.datastructure import ComponentRole
|
|
16
16
|
from sdmxlib.model.ref import short_urn as short_urn
|
|
@@ -393,6 +393,7 @@ __all__ = [
|
|
|
393
393
|
"Representation",
|
|
394
394
|
"RepresentationMap",
|
|
395
395
|
"RepresentationMapping",
|
|
396
|
+
"Resolve",
|
|
396
397
|
"ResolvePeriod",
|
|
397
398
|
"ResponseTooLargeError",
|
|
398
399
|
"RestRegistry",
|
|
@@ -35,12 +35,12 @@ Example:
|
|
|
35
35
|
import annotationlib
|
|
36
36
|
import functools
|
|
37
37
|
import inspect
|
|
38
|
-
from collections.abc import Sequence
|
|
39
38
|
from typing import overload
|
|
40
39
|
|
|
41
40
|
import httpx2
|
|
42
41
|
|
|
43
42
|
from sdmxlib.api.policy import RegistryUnavailable
|
|
43
|
+
from sdmxlib.api.registry import Resolve
|
|
44
44
|
from sdmxlib.model.binding import DataflowBinding, DriftError, DriftIssue, _validate_binding
|
|
45
45
|
from sdmxlib.model.ref import Ref, target_urn
|
|
46
46
|
from sdmxlib.model.registry import RegistryReader
|
|
@@ -129,7 +129,7 @@ class FederatedRegistry:
|
|
|
129
129
|
/,
|
|
130
130
|
*,
|
|
131
131
|
expect: type[T],
|
|
132
|
-
resolve:
|
|
132
|
+
resolve: Resolve = False,
|
|
133
133
|
partial: bool = True,
|
|
134
134
|
) -> T | None: ...
|
|
135
135
|
|
|
@@ -139,7 +139,7 @@ class FederatedRegistry:
|
|
|
139
139
|
target: SdmxUrn[T] | Ref[T],
|
|
140
140
|
/,
|
|
141
141
|
*,
|
|
142
|
-
resolve:
|
|
142
|
+
resolve: Resolve = False,
|
|
143
143
|
partial: bool = True,
|
|
144
144
|
) -> T | None: ...
|
|
145
145
|
|
|
@@ -149,7 +149,7 @@ class FederatedRegistry:
|
|
|
149
149
|
/,
|
|
150
150
|
*,
|
|
151
151
|
expect: type[T] | None = None,
|
|
152
|
-
resolve:
|
|
152
|
+
resolve: Resolve = False,
|
|
153
153
|
partial: bool = True,
|
|
154
154
|
) -> object:
|
|
155
155
|
"""Resolve ``target`` via the routed source.
|
|
@@ -175,8 +175,10 @@ class FederatedRegistry:
|
|
|
175
175
|
target: Identity of the artefact to read — a URN, or a `Ref`
|
|
176
176
|
naming one. Routing reads the *agency* off it, so a `Ref`
|
|
177
177
|
had to be unwrapped before this could route at all.
|
|
178
|
-
resolve: How deep to follow references
|
|
179
|
-
reference,
|
|
178
|
+
resolve: How deep to follow references, as on `RestRegistry.get`:
|
|
179
|
+
`True` for every reference, `"all"` or `"parents"` for the
|
|
180
|
+
artefacts referring to it, a sequence of artefact types for
|
|
181
|
+
only those.
|
|
180
182
|
partial: `False` asks for untrimmed codelists.
|
|
181
183
|
expect: The class the caller requires. The artefact is returned
|
|
182
184
|
when it is an instance, `None` otherwise — see
|
|
@@ -218,7 +220,7 @@ class FederatedRegistry:
|
|
|
218
220
|
source: RegistryReader,
|
|
219
221
|
urn: SdmxUrn[object],
|
|
220
222
|
*,
|
|
221
|
-
resolve:
|
|
223
|
+
resolve: Resolve,
|
|
222
224
|
partial: bool,
|
|
223
225
|
) -> dict[str, object]:
|
|
224
226
|
"""Which of ``resolve`` / ``partial`` this source can be asked for.
|
|
@@ -5,7 +5,7 @@ import threading
|
|
|
5
5
|
from collections.abc import Sequence
|
|
6
6
|
from contextlib import AbstractContextManager
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import Never, Self, Unpack, cast, overload
|
|
8
|
+
from typing import Literal, Never, Self, Unpack, cast, overload
|
|
9
9
|
|
|
10
10
|
import attrs
|
|
11
11
|
|
|
@@ -115,17 +115,26 @@ def _to_references(reference_type: type) -> str:
|
|
|
115
115
|
return sdmx_class.lower()
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
#: What `RestRegistry.get` follows: nothing, every reference, the artefacts
|
|
119
|
+
#: referring to it as well (``"all"``), only those (``"parents"``), or the
|
|
120
|
+
#: references to these types.
|
|
121
|
+
type Resolve = bool | Literal["all", "parents"] | Sequence[type]
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _references_for(*, resolve: Resolve) -> str:
|
|
119
125
|
"""The `references=` a resolution depth asks for.
|
|
120
126
|
|
|
121
127
|
Lifted out of `_read` when the freshness paths pushed it past the
|
|
122
128
|
complexity gate — and it reads better alone, being the one place the
|
|
123
|
-
|
|
129
|
+
`resolve` argument becomes a wire parameter. The two words come before
|
|
130
|
+
the sequence case, which a `str` would otherwise satisfy.
|
|
124
131
|
"""
|
|
125
132
|
if resolve is True:
|
|
126
133
|
return "descendants"
|
|
127
134
|
if resolve is False:
|
|
128
135
|
return "none"
|
|
136
|
+
if isinstance(resolve, str):
|
|
137
|
+
return resolve
|
|
129
138
|
return ",".join(sorted(_to_references(t) for t in resolve))
|
|
130
139
|
|
|
131
140
|
|
|
@@ -550,7 +559,7 @@ class RestRegistry:
|
|
|
550
559
|
return cached
|
|
551
560
|
return self._local_cache_lookup(urn)
|
|
552
561
|
|
|
553
|
-
def _confirmed[T](self, urn: SdmxUrn[T], *, completeness: Completeness) -> T | None:
|
|
562
|
+
def _confirmed[T](self, urn: SdmxUrn[T], *, completeness: Completeness, parents: bool = False) -> T | None:
|
|
554
563
|
"""What a confirmed-unmoved pointer resolves to, or `None` to ask again.
|
|
555
564
|
|
|
556
565
|
`None` means the provider vouched for a pointer whose artefact this
|
|
@@ -558,12 +567,12 @@ class RestRegistry:
|
|
|
558
567
|
freshness that vouched for it is dropped on the way out, so the retry
|
|
559
568
|
goes to the provider instead of looping on the same confirmation.
|
|
560
569
|
"""
|
|
561
|
-
held = self._settled_answer(urn, completeness=completeness)
|
|
570
|
+
held = self._settled_answer(urn, completeness=completeness, parents=parents)
|
|
562
571
|
if held is None:
|
|
563
572
|
self._forget(str(urn))
|
|
564
573
|
return held
|
|
565
574
|
|
|
566
|
-
def _settled_answer[T](self, urn: SdmxUrn[T], *, completeness: Completeness) -> T | None:
|
|
575
|
+
def _settled_answer[T](self, urn: SdmxUrn[T], *, completeness: Completeness, parents: bool = False) -> T | None:
|
|
567
576
|
"""What a confirmed-unmoved `latest` pointer resolves to, if still held.
|
|
568
577
|
|
|
569
578
|
This is a `latest -> pinned` map, which #338 deleted. The difference is
|
|
@@ -579,7 +588,7 @@ class RestRegistry:
|
|
|
579
588
|
# cannot say so — the documented "localize the unsafe object -> T step
|
|
580
589
|
# to the accessor" case from CLAUDE.md, written as a cast rather than a
|
|
581
590
|
# suppression so it belongs to no single checker.
|
|
582
|
-
held = self._session.get_at_least(settled, completeness)
|
|
591
|
+
held = self._session.get_at_least(settled, completeness, parents=parents)
|
|
583
592
|
return cast("T | None", held)
|
|
584
593
|
|
|
585
594
|
def _remember_pointer(self, latest: str, pinned: SdmxUrn[object]) -> None:
|
|
@@ -763,7 +772,7 @@ class RestRegistry:
|
|
|
763
772
|
/,
|
|
764
773
|
*,
|
|
765
774
|
expect: type[T],
|
|
766
|
-
resolve:
|
|
775
|
+
resolve: Resolve = False,
|
|
767
776
|
partial: bool = True,
|
|
768
777
|
) -> T | None: ...
|
|
769
778
|
|
|
@@ -773,7 +782,7 @@ class RestRegistry:
|
|
|
773
782
|
target: SdmxUrn[T] | Ref[T],
|
|
774
783
|
/,
|
|
775
784
|
*,
|
|
776
|
-
resolve:
|
|
785
|
+
resolve: Resolve = False,
|
|
777
786
|
partial: bool = True,
|
|
778
787
|
) -> T | None: ...
|
|
779
788
|
|
|
@@ -783,7 +792,7 @@ class RestRegistry:
|
|
|
783
792
|
/,
|
|
784
793
|
*,
|
|
785
794
|
expect: type[T] | None = None,
|
|
786
|
-
resolve:
|
|
795
|
+
resolve: Resolve = False,
|
|
787
796
|
partial: bool = True,
|
|
788
797
|
) -> object:
|
|
789
798
|
"""Read one artefact by identity.
|
|
@@ -801,6 +810,16 @@ class RestRegistry:
|
|
|
801
810
|
reg.get(urn, resolve=True) # every reference followed
|
|
802
811
|
reg.get(urn, resolve=[sl.Codelist]) # only refs of these types
|
|
803
812
|
reg.get(urn, resolve=True, partial=False) # and untrimmed
|
|
813
|
+
reg.get(urn, resolve="all") # and what refers to it
|
|
814
|
+
reg.get(urn, resolve="parents") # only what refers to it
|
|
815
|
+
|
|
816
|
+
`"all"` and `"parents"` bring the artefacts that refer to this one:
|
|
817
|
+
the constraints on a dataflow, and the hierarchy associations linked
|
|
818
|
+
to it or to its DSD's dimensions. A ``descendants`` fetch never
|
|
819
|
+
returns them, so a bundle's structural closure needs one of these.
|
|
820
|
+
Over SDMX 2.1 no hierarchy association arrives, since 2.1
|
|
821
|
+
has none. `"parents"` asks for the artefact's own fields in full and
|
|
822
|
+
follows none of its references.
|
|
804
823
|
|
|
805
824
|
**The default differs from `LocalRegistry.get`, and that is not an
|
|
806
825
|
inconsistency.** Resolving is a join away locally and another round
|
|
@@ -810,7 +829,9 @@ class RestRegistry:
|
|
|
810
829
|
Args:
|
|
811
830
|
target: A URN, or a `Ref` from graph traversal. Positional-only,
|
|
812
831
|
and the same two types every other `get` takes.
|
|
813
|
-
resolve: `False` for a skeleton, `True` for every reference,
|
|
832
|
+
resolve: `False` for a skeleton, `True` for every reference,
|
|
833
|
+
`"all"` for every reference and every artefact referring to
|
|
834
|
+
this one, `"parents"` for only the referring ones, or a
|
|
814
835
|
sequence of artefact types to follow only those.
|
|
815
836
|
partial: When resolving, trim referenced ItemSchemes by their
|
|
816
837
|
DataConstraints. `False` for a full audit.
|
|
@@ -844,13 +865,15 @@ class RestRegistry:
|
|
|
844
865
|
return found if isinstance(found, expect) else None
|
|
845
866
|
return found
|
|
846
867
|
|
|
847
|
-
def _read[T](self, urn: SdmxUrn[T], *, resolve:
|
|
868
|
+
def _read[T](self, urn: SdmxUrn[T], *, resolve: Resolve, partial: bool) -> T:
|
|
848
869
|
"""`get` without the not-found translation, for callers that require one."""
|
|
849
|
-
wants_refs = bool(resolve)
|
|
870
|
+
wants_refs = bool(resolve) and resolve != "parents"
|
|
850
871
|
detail = ("referencepartial" if partial else "full") if wants_refs else "full"
|
|
851
872
|
references = _references_for(resolve=resolve)
|
|
852
873
|
wanted = completeness_of(detail=detail, references=references)
|
|
853
|
-
|
|
874
|
+
# The two words are the only `str` values; a type list is unhashable.
|
|
875
|
+
parents = isinstance(resolve, str)
|
|
876
|
+
cached = self._session.get_at_least(urn, wanted, parents=parents)
|
|
854
877
|
if cached is not None:
|
|
855
878
|
return cached
|
|
856
879
|
if not wants_refs:
|
|
@@ -867,7 +890,7 @@ class RestRegistry:
|
|
|
867
890
|
references=references,
|
|
868
891
|
)
|
|
869
892
|
if fetched is NOT_MODIFIED:
|
|
870
|
-
confirmed = self._confirmed(urn, completeness=wanted)
|
|
893
|
+
confirmed = self._confirmed(urn, completeness=wanted, parents=parents)
|
|
871
894
|
if confirmed is not None:
|
|
872
895
|
return confirmed
|
|
873
896
|
return self._read(urn, resolve=resolve, partial=partial)
|
|
@@ -880,6 +903,8 @@ class RestRegistry:
|
|
|
880
903
|
self._raise_if_refused(urn)
|
|
881
904
|
err = f"{urn} not found in response"
|
|
882
905
|
raise KeyError(err)
|
|
906
|
+
if parents and isinstance(result, SupportsUrn):
|
|
907
|
+
self._session.record_parents(artefact_urn(result))
|
|
883
908
|
if urn.version == "latest" and isinstance(result, SupportsUrn):
|
|
884
909
|
self._remember_pointer(str(urn), artefact_urn(result))
|
|
885
910
|
return result
|
|
@@ -43,6 +43,10 @@ class Completeness(IntEnum):
|
|
|
43
43
|
FULL = 2
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
#: The ``references=`` values that follow none of an artefact's own references.
|
|
47
|
+
_UPWARD = frozenset({"none", "parents", "parentsandsiblings", "ancestors"})
|
|
48
|
+
|
|
49
|
+
|
|
46
50
|
def completeness_of(*, detail: str, references: str) -> Completeness:
|
|
47
51
|
"""What a fetch with these wire parameters learns.
|
|
48
52
|
|
|
@@ -52,8 +56,13 @@ def completeness_of(*, detail: str, references: str) -> Completeness:
|
|
|
52
56
|
`references` about depth — and reading `detail` alone would mark the
|
|
53
57
|
commonest unresolved fetch in the library as the most complete one there
|
|
54
58
|
is.
|
|
59
|
+
|
|
60
|
+
A request for the artefacts that refer to this one (``parents``, and the
|
|
61
|
+
other directions that point up the graph) follows none of its own
|
|
62
|
+
references, so it is `UNRESOLVED` too. What it learns is recorded apart,
|
|
63
|
+
by `Session.record_parents` (GH-221).
|
|
55
64
|
"""
|
|
56
|
-
if references
|
|
65
|
+
if references in _UPWARD:
|
|
57
66
|
return Completeness.UNRESOLVED
|
|
58
67
|
return Completeness.FULL if detail == "full" else Completeness.PARTIAL
|
|
59
68
|
|
|
@@ -69,6 +78,11 @@ class Session:
|
|
|
69
78
|
- ``_map``: URN → artefact (all ingested)
|
|
70
79
|
- ``_completeness``: URN → `Completeness`, how deeply it has been fetched
|
|
71
80
|
|
|
81
|
+
and a set, ``_parents``, of the URNs whose referring artefacts were
|
|
82
|
+
fetched too (``references=parents`` or ``all``). Direction is apart from
|
|
83
|
+
depth: a ``descendants`` fetch at any depth says nothing about what refers
|
|
84
|
+
to an artefact, so it must not answer a request that needs that (GH-221).
|
|
85
|
+
|
|
72
86
|
The second is a record, not a second cache: `_map` holds the one object
|
|
73
87
|
per URN, and a fuller fetch replaces it — a reference held into the older
|
|
74
88
|
one finds the fuller one through its registry (#492). `get_at_least` reads the pair — see `Completeness` for why
|
|
@@ -90,6 +104,7 @@ class Session:
|
|
|
90
104
|
# and admits the registry-cache path that writes an unbounded ``T``.
|
|
91
105
|
self._map: dict[str, object] = {}
|
|
92
106
|
self._completeness: dict[str, Completeness] = {}
|
|
107
|
+
self._parents: set[str] = set()
|
|
93
108
|
self._class_tomsg_field: dict[str, str] = {}
|
|
94
109
|
|
|
95
110
|
def ingest(
|
|
@@ -148,23 +163,31 @@ class Session:
|
|
|
148
163
|
return hit # pyrefly: ignore[bad-return]
|
|
149
164
|
return None
|
|
150
165
|
|
|
151
|
-
def get_at_least[T](self, urn: SdmxUrn[T], completeness: Completeness) -> T | None:
|
|
166
|
+
def get_at_least[T](self, urn: SdmxUrn[T], completeness: Completeness, *, parents: bool = False) -> T | None:
|
|
152
167
|
"""A cached artefact, if it is known at least this completely.
|
|
153
168
|
|
|
154
169
|
`None` otherwise — including when the artefact *is* held but less
|
|
155
170
|
completely than asked. That case must go to
|
|
156
|
-
the provider, and returning the shallower object is #344.
|
|
171
|
+
the provider, and returning the shallower object is #344. With
|
|
172
|
+
`parents`, also `None` unless the artefacts referring to it were
|
|
173
|
+
fetched (`record_parents`).
|
|
157
174
|
|
|
158
175
|
Same `latest` rule as `get` — see there for why.
|
|
159
176
|
"""
|
|
160
177
|
key = str(urn)
|
|
161
178
|
if self._completeness.get(key, Completeness.UNRESOLVED) < completeness:
|
|
162
179
|
return None
|
|
180
|
+
if parents and key not in self._parents:
|
|
181
|
+
return None
|
|
163
182
|
hit = self._map.get(key)
|
|
164
183
|
if hit is not None:
|
|
165
184
|
return hit # pyrefly: ignore[bad-return]
|
|
166
185
|
return None
|
|
167
186
|
|
|
187
|
+
def record_parents(self, urn: SdmxUrn[object]) -> None:
|
|
188
|
+
"""Record that the artefacts referring to `urn` were fetched with it."""
|
|
189
|
+
self._parents.add(str(urn))
|
|
190
|
+
|
|
168
191
|
def completeness_for(self, urn: SdmxUrn[object]) -> Completeness:
|
|
169
192
|
"""How completely `urn` is known here. `UNRESOLVED` when not held."""
|
|
170
193
|
return self._completeness.get(str(urn), Completeness.UNRESOLVED)
|
|
@@ -31,7 +31,7 @@ from typing import Literal
|
|
|
31
31
|
|
|
32
32
|
import duckdb
|
|
33
33
|
|
|
34
|
-
from sdmxlib.local.registry import BundleRegistry
|
|
34
|
+
from sdmxlib.local.registry import BundleRegistry, LocalRegistry
|
|
35
35
|
from sdmxlib.model.binding import DataflowBinding
|
|
36
36
|
from sdmxlib.model.constraint import (
|
|
37
37
|
ComponentValueSet,
|
|
@@ -169,6 +169,15 @@ def build_component_availability(
|
|
|
169
169
|
`tests/bench/test_availability_scan_shape.py` keeps that answer attached to
|
|
170
170
|
evidence, and fails if a DuckDB release ever reverses it.
|
|
171
171
|
|
|
172
|
+
A published bundle's stored availability (`BundleRegistry.availability`)
|
|
173
|
+
removes work without changing the answer. A dimension whose selected
|
|
174
|
+
values include every value it holds excludes no row, so its constraint is
|
|
175
|
+
dropped before scanning; a dimension left with no constraint at all takes
|
|
176
|
+
its values from the stored availability, with no scan. An attribute
|
|
177
|
+
always scans, since stored availability lists dimensions only, and so
|
|
178
|
+
does every component of a `LocalRegistry`, whose stored availability may
|
|
179
|
+
belong to the publication it extends.
|
|
180
|
+
|
|
172
181
|
The two modes differ only in which filter applies while enumerating a
|
|
173
182
|
component ``C``:
|
|
174
183
|
|
|
@@ -248,17 +257,23 @@ def build_component_availability(
|
|
|
248
257
|
|
|
249
258
|
targets = sorted(binding.dimension_column_map) if component_id == "all" else [component_id]
|
|
250
259
|
|
|
260
|
+
held = _held_values(registry, dataflow_urn)
|
|
261
|
+
component_filter = _drop_covering(component_filter, held)
|
|
262
|
+
|
|
251
263
|
table = f"{binding.database_role}.{binding.table_location}"
|
|
252
264
|
key_values: list[KeyValue] = []
|
|
253
265
|
components: list[ComponentValueSet] = []
|
|
254
266
|
for target in targets:
|
|
255
267
|
column = _component_column(binding, target)
|
|
256
268
|
applied = _drop_constraint(component_filter, target) if mode == "available" else component_filter
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
269
|
+
if applied.is_wildcard and target in held:
|
|
270
|
+
values = held[target]
|
|
271
|
+
else:
|
|
272
|
+
where, params = applied.to_where_clauses(
|
|
273
|
+
binding.dimension_column_map,
|
|
274
|
+
binding.attribute_column_map,
|
|
275
|
+
)
|
|
276
|
+
values = frozenset(_distinct_values(conn, table, column, where=where, params=params))
|
|
262
277
|
# A dimension is a region's key; an attribute is one of its component
|
|
263
278
|
# value sets (2.1 `Attribute`, 3.x `Component`). Both were keys until
|
|
264
279
|
# #433 gave components a field, so an attribute read as a dimension.
|
|
@@ -313,6 +328,41 @@ def _component_column(binding: DataflowBinding, component_id: str) -> str:
|
|
|
313
328
|
return column
|
|
314
329
|
|
|
315
330
|
|
|
331
|
+
def _held_values(registry: BundleRegistry, dataflow_urn: SdmxUrn[Dataflow]) -> dict[str, frozenset[str]]:
|
|
332
|
+
"""The values each dimension holds, from the publication's stored availability; empty when it has none.
|
|
333
|
+
|
|
334
|
+
Only a published bundle's stored availability describes its data. A
|
|
335
|
+
`LocalRegistry` started with ``build(previous=)`` holds the previous
|
|
336
|
+
publication's availability until `write_manifest` replaces it, while its
|
|
337
|
+
lake may already hold other rows, so it reads as none here and every
|
|
338
|
+
component scans.
|
|
339
|
+
"""
|
|
340
|
+
if isinstance(registry, LocalRegistry):
|
|
341
|
+
return {}
|
|
342
|
+
stored = registry.availability(dataflow_urn)
|
|
343
|
+
if stored is None:
|
|
344
|
+
return {}
|
|
345
|
+
return {kv.dimension_id: kv.codes() for kv in stored.region.keys}
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def _drop_covering(component_filter: ComponentFilter, held: dict[str, frozenset[str]]) -> ComponentFilter:
|
|
349
|
+
"""Return a copy of ``component_filter`` without each dimension whose selection covers every value it holds.
|
|
350
|
+
|
|
351
|
+
Such a selection excludes no row, so the scan's answer is the same
|
|
352
|
+
without it. A dimension selected by a `SqlRelation`, or absent
|
|
353
|
+
from ``held``, keeps its constraint.
|
|
354
|
+
"""
|
|
355
|
+
dimensions = [
|
|
356
|
+
None if isinstance(selected, list) and dim_id in held and held[dim_id] <= set(selected) else selected
|
|
357
|
+
for dim_id, selected in zip(component_filter.dimension_ids, component_filter.dimensions, strict=True)
|
|
358
|
+
]
|
|
359
|
+
return ComponentFilter(
|
|
360
|
+
dimension_ids=component_filter.dimension_ids,
|
|
361
|
+
dimensions=dimensions,
|
|
362
|
+
attributes=component_filter.attributes,
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
|
|
316
366
|
def _drop_constraint(component_filter: ComponentFilter, component_id: str) -> ComponentFilter:
|
|
317
367
|
"""Return a copy of ``component_filter`` with ``component_id``'s constraint removed.
|
|
318
368
|
|
|
@@ -10,7 +10,9 @@ an ETag keys on. ``LocalRegistry.bundle(publication)`` opens it read-only.
|
|
|
10
10
|
`check_bundle` checks a publication against it and against itself;
|
|
11
11
|
`copy_bundle` copies one elsewhere, manifest last, and `bundle_files` lists
|
|
12
12
|
what such a copy needs for another tool; `verify_remote` checks the
|
|
13
|
-
files a server reads from object storage by size and a digest the store keeps;
|
|
13
|
+
files a server reads from object storage by size and a digest the store keeps; `build_bundle`
|
|
14
|
+
builds one from dataflows' closures at a registry and the observations a
|
|
15
|
+
producer holds, cutting codelists to partials; and `fetch_bundle` lands
|
|
14
16
|
one dataflow from an SDMX REST source as a published bundle, its provenance
|
|
15
17
|
recorded. `apply_overlays` changes display annotations without a rebuild,
|
|
16
18
|
`effective_token` is what a cache keys on when it does, and `fold_overlays`
|
|
@@ -42,6 +44,7 @@ from sdmxlib.bundle._check import Check, Profile, Report, check_bundle, check_on
|
|
|
42
44
|
from sdmxlib.bundle._finding import Finding
|
|
43
45
|
from sdmxlib.bundle._copy import bundle_files, copy_bundle
|
|
44
46
|
from sdmxlib.bundle._remote import RemoteFile, content_crc32c, content_md5, verify_remote
|
|
47
|
+
from sdmxlib.bundle._build import build_bundle
|
|
45
48
|
from sdmxlib.bundle._fetch import fetch_bundle
|
|
46
49
|
from sdmxlib.bundle._overlay import (
|
|
47
50
|
OVERLAY_FORMAT,
|
|
@@ -110,6 +113,7 @@ __all__ = [
|
|
|
110
113
|
"Tier",
|
|
111
114
|
"applied",
|
|
112
115
|
"apply_overlays",
|
|
116
|
+
"build_bundle",
|
|
113
117
|
"bundle_files",
|
|
114
118
|
"canonical_json",
|
|
115
119
|
"check_bundle",
|