sdmxlib 0.81.0__tar.gz → 0.83.0__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.81.0 → sdmxlib-0.83.0}/PKG-INFO +1 -1
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/pyproject.toml +1 -1
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/pyproject.toml.orig +1 -1
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/EGM.md +39 -10
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/__init__.py +6 -2
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_build.py +200 -35
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_check.py +123 -50
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_copy.py +34 -5
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_write.py +32 -10
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/EGM.md +9 -2
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/__init__.py +3 -1
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/_format.py +41 -10
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/_rules.py +17 -1
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/root.schema.json +3 -2
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/EGM.md +10 -7
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/registry.py +35 -3
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/EGM.md +30 -5
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/__init__.py +9 -0
- sdmxlib-0.83.0/src/sdmxlib/storage/_files.py +147 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_layout.py +7 -7
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_manifest.py +38 -4
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_references.py +62 -7
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_trim.py +3 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/LICENSE +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/README.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/_duckdb.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/_facet_types.xsd +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/_facets.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/_read_errors.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/_singleflight.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/_time.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/_freshness.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/client.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/federated.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/policy.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/providers.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/registry.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/api/session.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/contentconstraint.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/data_store.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_availability.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_canonical.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_fetch.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_finding.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_fingerprint.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_overlay.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_remote.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/manifest.schema.json +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/overlay.schema.json +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_arrow.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_attachment.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_coerce.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_index.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_positions.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_refuse.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_tags.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/data_format.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/gaps.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/render.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json_1_0/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/_reader.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/conformance.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/catalog.schema.json +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/current.schema.json +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/leaf.schema.json +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/_scan.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/data_store.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/engine.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/object_store.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/local/sql.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_binding.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_container.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_invariants.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_items.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_label_match.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_rebind.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_referenceable.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_refshape.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_resolvers.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_rules.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_tree.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/annotations.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/base.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/binding.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/category.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/codelist.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/collections.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/concept.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/constraint.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/convert.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/dataflow.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/datastructure.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/errors.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/expr.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/header.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/hierarchy.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/istring.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/link.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/mapping.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/message.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadata_provision.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadataflow.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadataset.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadatastructure.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/organisation.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/provision.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/ref.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/registry.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/representation.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/rest_api.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/rollup.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/urn.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/validation.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/valuelist.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/version.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/model/version_rewrite.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/polars.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/py.typed +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/EGM.md +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/__init__.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_closure.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_common.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_compile.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_edges.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_execute.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_expr.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_joins.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_plan.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_pushdown.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_rebase.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_rest.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/accessors.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/observations.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/query.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/raw.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/query/schema.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/rest.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/session.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/sql.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_checked.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_columns.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_kinds.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_parsed.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_projections.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_synthetic.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_tags.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/lazy.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/readers.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/resolve.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/schema.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/writers.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/src/sdmxlib/testing.py +0 -0
- {sdmxlib-0.81.0 → sdmxlib-0.83.0}/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.83.0
|
|
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
|
|
@@ -34,7 +34,14 @@ seals through `seal(extensions=...)`.
|
|
|
34
34
|
implements, and `Profile` is the profile literal. Findings are `Finding`s
|
|
35
35
|
(`_finding.py`). An argument the profile does not use (`structures=` at
|
|
36
36
|
`open`, `remote=` at `publish`, `lookup=` or `fingerprints=` outside
|
|
37
|
-
`receive`) raises `ValueError`.
|
|
37
|
+
`receive`) raises `ValueError`. `structures=` takes one edition or a
|
|
38
|
+
sequence of them, and a partial is checked against the one holding its
|
|
39
|
+
full artefact with its `partial_of` fingerprint; an empty sequence raises
|
|
40
|
+
`ValueError`. For an edition with no bindings (a structure product), the
|
|
41
|
+
`references` check also accepts a reference one of the `structures=`
|
|
42
|
+
editions holds as a full artefact or an item of one
|
|
43
|
+
(`storage._references.held_targets`; spec §6.5 item 9, GH-351). A data
|
|
44
|
+
product's references resolve in its own edition alone.
|
|
38
45
|
- `check_on_open` (`_check.py`): runs one profile per call. Without a stamp
|
|
39
46
|
for this `(product_id, edition id, manifest sha256)` it runs `receive` and writes
|
|
40
47
|
the stamp when the report is clean; with one it runs `open`. An unreadable
|
|
@@ -45,9 +52,18 @@ seals through `seal(extensions=...)`.
|
|
|
45
52
|
- `verify_remote`, `RemoteFile`, `content_md5` and `content_crc32c`
|
|
46
53
|
(`_remote.py`): check files in an object store by size and digest. The
|
|
47
54
|
digests are the base64 values used in headers.
|
|
48
|
-
- `build_edition` (`_build.py`): builds
|
|
49
|
-
producer observations. With `partials=True` (the
|
|
50
|
-
down to partials.
|
|
55
|
+
- `build_edition` (`_build.py`): builds a new product's first edition from
|
|
56
|
+
dataflow closures and producer observations. With `partials=True` (the
|
|
57
|
+
default) it cuts codelists down to partials. It opens the builder, calls
|
|
58
|
+
`fill_edition` and seals.
|
|
59
|
+
- `fill_edition` (`_build.py`): adds dataflow closures and observations to a
|
|
60
|
+
builder the caller opened, cuts its codelists, and returns the `partial_of`
|
|
61
|
+
mapping for the caller's `seal`. It keeps what the builder held; the cut
|
|
62
|
+
covers every binding in the builder (GH-347).
|
|
63
|
+
- `fill_structures` (`_build.py`): copies full artefacts into a builder for a
|
|
64
|
+
structure product, selected by family, agency, id pattern and URN. It
|
|
65
|
+
refuses dataflows, bindings, partials and an empty selection, and adds
|
|
66
|
+
nothing the selected artefacts reference (GH-347).
|
|
51
67
|
- `fetch_edition` (`_fetch.py`): fetches one dataflow over SDMX REST into a new
|
|
52
68
|
sealed edition that records its `Provenance`. It calls `build_edition`
|
|
53
69
|
with `partials=False`.
|
|
@@ -82,6 +98,10 @@ seals through `seal(extensions=...)`.
|
|
|
82
98
|
|
|
83
99
|
- An edition is never rewritten. `seal` raises `ManifestError`
|
|
84
100
|
when `manifest.json` already exists.
|
|
101
|
+
- `seal` records `partial_of` for a partial its `partial_of=` names, and
|
|
102
|
+
otherwise the value the previous edition's manifest records for it.
|
|
103
|
+
- `fill_edition` and `fill_structures` never open, close or seal the
|
|
104
|
+
builder. `fill_structures` checks its whole selection before it writes.
|
|
85
105
|
- `seal` requires a `edition_id` in the meta store, which
|
|
86
106
|
`LocalRegistry.build` sets. It then works in this order: `settle_lake` (when
|
|
87
107
|
`tables.ducklake` exists), `clear_availability`, the binding survey (when
|
|
@@ -90,13 +110,20 @@ seals through `seal(extensions=...)`.
|
|
|
90
110
|
for writing. An edition refused at the survey or at the `*.wal` check is
|
|
91
111
|
left settled with its availability cleared; a rerun after fixing the cause
|
|
92
112
|
redoes both.
|
|
93
|
-
- `seal` and `copy_edition` both
|
|
94
|
-
|
|
113
|
+
- `seal` and `copy_edition` both create the manifest with
|
|
114
|
+
`storage.create_exclusive`: staged, fsynced, hard-linked into place, the
|
|
115
|
+
directory fsynced. A manifest another process created first is never
|
|
116
|
+
replaced; both raise `ManifestError`. `seal` writes the journal entry
|
|
117
|
+
with `replace_durably` and fsyncs the compacted store before its rename
|
|
118
|
+
(GH-335).
|
|
119
|
+
- `list_files` and the `files` check skip `storage._manifest.unlisted`
|
|
120
|
+
names: the manifest, its signature, and a staged manifest a crash left.
|
|
95
121
|
- Data files are always tier 3. `metadata.duckdb` and `tables.ducklake` default to
|
|
96
122
|
tier 1, and other files to tier 2.
|
|
97
123
|
- `copy_edition` skips a `data/` file already present with the same size and
|
|
98
124
|
digest, raises when a copied file does not match, and refuses a destination
|
|
99
|
-
that is already sealed.
|
|
125
|
+
that is already sealed. Every file it copied is fsynced before the manifest
|
|
126
|
+
exists.
|
|
100
127
|
- `check_on_open` writes a stamp only after a clean `receive` check, and only
|
|
101
128
|
to a path made of exactly two plain components under the stamps directory.
|
|
102
129
|
- `settle_lake` never deletes files from `data/`.
|
|
@@ -124,9 +151,11 @@ seals through `seal(extensions=...)`.
|
|
|
124
151
|
- `seal` clears per-binding availability in `metadata.duckdb` and, when
|
|
125
152
|
availability is enabled, stores it again.
|
|
126
153
|
- `copy_edition` creates directories and copies files with `shutil.copyfile`,
|
|
127
|
-
then copies the detached signature
|
|
128
|
-
|
|
129
|
-
a
|
|
154
|
+
then copies the detached signature. It fsyncs each copied file, the
|
|
155
|
+
signature included, and each directory it created or wrote into (with the
|
|
156
|
+
directory naming a created one), then creates the manifest last (GH-344).
|
|
157
|
+
- `check_on_open` writes the JSON stamp `<stamps>/<product_id>/<edition_id>`
|
|
158
|
+
with `storage._files.replace_durably`, which replaces any stamp there.
|
|
130
159
|
- `fetch_edition` makes SDMX REST requests and creates a product directory.
|
|
131
160
|
`verify_remote` and `check_edition(remote=...)` read from object storage.
|
|
132
161
|
|
|
@@ -12,7 +12,9 @@ an ETag keys on. ``LocalRegistry.edition(edition_dir)`` opens it read-only.
|
|
|
12
12
|
what such a copy needs for another tool; `verify_remote` checks the
|
|
13
13
|
files a server reads from object storage by size and a digest the store keeps; `build_edition`
|
|
14
14
|
builds one from dataflows' closures at a registry and the observations a
|
|
15
|
-
producer holds, cutting codelists to partials;
|
|
15
|
+
producer holds, cutting codelists to partials; `fill_edition` does the same
|
|
16
|
+
into a builder its caller opened and seals, and `fill_structures` fills one
|
|
17
|
+
with a structure product's full artefacts; and `fetch_edition` lands
|
|
16
18
|
one dataflow from an SDMX REST source as a sealed edition, its provenance
|
|
17
19
|
recorded. `apply_overlays` changes display annotations without a rebuild,
|
|
18
20
|
`effective_token` is what a cache keys on when it does, and `fold_overlays`
|
|
@@ -44,7 +46,7 @@ from sdmxlib.edition._check import Check, Profile, Report, check_edition, check_
|
|
|
44
46
|
from sdmxlib.edition._finding import Finding
|
|
45
47
|
from sdmxlib.edition._copy import edition_files, copy_edition
|
|
46
48
|
from sdmxlib.edition._remote import RemoteFile, content_crc32c, content_md5, verify_remote
|
|
47
|
-
from sdmxlib.edition._build import build_edition
|
|
49
|
+
from sdmxlib.edition._build import build_edition, fill_edition, fill_structures
|
|
48
50
|
from sdmxlib.edition._fetch import fetch_edition
|
|
49
51
|
from sdmxlib.edition._overlay import (
|
|
50
52
|
OVERLAY_FORMAT,
|
|
@@ -135,6 +137,8 @@ __all__ = [
|
|
|
135
137
|
"edition_files",
|
|
136
138
|
"effective_token",
|
|
137
139
|
"fetch_edition",
|
|
140
|
+
"fill_edition",
|
|
141
|
+
"fill_structures",
|
|
138
142
|
"fold_overlays",
|
|
139
143
|
"list_editions",
|
|
140
144
|
"list_files",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
"""Building an edition from a registry and the observations a producer holds (GH-223).
|
|
1
|
+
"""Building an edition from a registry and the observations a producer holds (GH-223, GH-347).
|
|
2
2
|
|
|
3
|
-
`
|
|
4
|
-
its codelists cut to partials
|
|
5
|
-
|
|
3
|
+
`fill_edition` is the one place a dataflow's structural closure is selected and
|
|
4
|
+
its codelists cut to partials, into a builder its caller opened and seals.
|
|
5
|
+
`build_edition` opens a new product's first edition, fills it and seals it;
|
|
6
|
+
`fetch_edition` is a call to it. `fill_structures` fills a builder with the
|
|
7
|
+
full artefacts of a structure product, chosen by family, agency, id pattern and
|
|
8
|
+
URN (`docs/design/open-builder-structures.md`).
|
|
6
9
|
|
|
7
10
|
**The closure is the fingerprint's.** It is what `References.closure` selects
|
|
8
11
|
from the dataflow and its data structure: what they refer to, every artefact
|
|
@@ -21,7 +24,8 @@ stays full too when it has extensions, when a component it enumerates has no
|
|
|
21
24
|
column in written observations, and when the cut would keep every code.
|
|
22
25
|
"""
|
|
23
26
|
|
|
24
|
-
from collections.abc import Iterable, Mapping, Sequence
|
|
27
|
+
from collections.abc import Collection, Iterable, Mapping, Sequence
|
|
28
|
+
from fnmatch import fnmatchcase
|
|
25
29
|
from pathlib import Path
|
|
26
30
|
|
|
27
31
|
import msgspec
|
|
@@ -38,9 +42,10 @@ from sdmxlib.model.codelist import CascadeSelection, Codelist
|
|
|
38
42
|
from sdmxlib.model.constraint import ComponentValueSet, ConstraintType, DataConstraint, KeyValue
|
|
39
43
|
from sdmxlib.model.dataflow import Dataflow
|
|
40
44
|
from sdmxlib.model.datastructure import DataStructure
|
|
41
|
-
from sdmxlib.model.ref import Ref
|
|
45
|
+
from sdmxlib.model.ref import Ref, urn_of
|
|
42
46
|
from sdmxlib.model.urn import SdmxUrn
|
|
43
47
|
from sdmxlib.storage._columns import table_columns
|
|
48
|
+
from sdmxlib.storage._kinds import CLASS_TO_NAME
|
|
44
49
|
from sdmxlib.storage._manifest import Manifest, Producer, Provenance
|
|
45
50
|
|
|
46
51
|
#: The lake schema a dataflow's observations are written to.
|
|
@@ -98,23 +103,13 @@ def build_edition(
|
|
|
98
103
|
column holds a value outside its codelist, naming the dataflow,
|
|
99
104
|
the component and the values.
|
|
100
105
|
"""
|
|
101
|
-
rows = dict(observations or {})
|
|
102
106
|
root = Path(path)
|
|
103
107
|
if root.exists() and any(root.iterdir()):
|
|
104
108
|
msg = f"{root} exists and is not empty; build_edition creates a new edition"
|
|
105
109
|
raise FileExistsError(msg)
|
|
106
110
|
root.mkdir(parents=True, exist_ok=True)
|
|
107
111
|
with LocalRegistry.build(root) as builder:
|
|
108
|
-
|
|
109
|
-
# Rows are found by the URN given or the one it resolved to.
|
|
110
|
-
keys = [{str(given), str(flow.urn)} for given, (flow, _) in zip(dataflows, flows, strict=True)]
|
|
111
|
-
unknown = sorted(set(rows) - set().union(*keys))
|
|
112
|
-
if unknown:
|
|
113
|
-
msg = f"observations name {', '.join(unknown)}, which is not among the dataflows built"
|
|
114
|
-
raise ValueError(msg)
|
|
115
|
-
found = [next((rows[key] for key in sorted(names) if key in rows), None) for names in keys]
|
|
116
|
-
bound = _write(builder, flows, found)
|
|
117
|
-
cut = _cut(builder, flows, bound) if partials else {}
|
|
112
|
+
cut = fill_edition(builder, source, dataflows, observations=observations, partials=partials)
|
|
118
113
|
stored = builder.connection.execute(
|
|
119
114
|
"SELECT urn FROM sdmx.artefact WHERE artefact_type <> 'DataflowBinding' ORDER BY urn"
|
|
120
115
|
).fetchall()
|
|
@@ -127,6 +122,158 @@ def build_edition(
|
|
|
127
122
|
)
|
|
128
123
|
|
|
129
124
|
|
|
125
|
+
def fill_edition(
|
|
126
|
+
builder: LocalRegistry,
|
|
127
|
+
source: RestRegistry | EditionRegistry,
|
|
128
|
+
dataflows: Sequence[SdmxUrn[Dataflow]],
|
|
129
|
+
*,
|
|
130
|
+
observations: Mapping[str, WriteSource] | None = None,
|
|
131
|
+
partials: bool = True,
|
|
132
|
+
) -> dict[str, str]:
|
|
133
|
+
"""Add each dataflow's closure at `source` and its observations to an open builder, and cut its codelists.
|
|
134
|
+
|
|
135
|
+
The builder is the caller's: `LocalRegistry.build` opened it, empty or
|
|
136
|
+
on a previous edition, and the caller seals it, passing the returned
|
|
137
|
+
mapping as ``seal(partial_of=...)``. Nothing here opens, closes or seals it.
|
|
138
|
+
|
|
139
|
+
What the builder held before is kept. An artefact of the closure the
|
|
140
|
+
builder already held is replaced by the one at `source`, so a full
|
|
141
|
+
codelist from `source` replaces a partial carried from the previous
|
|
142
|
+
edition. A dataflow given rows gets a table, ``obs.<table_for(urn)>``,
|
|
143
|
+
whose rows the new ones replace, and a binding; a dataflow given none
|
|
144
|
+
keeps the binding the builder holds, if any. With `partials`, the cut
|
|
145
|
+
covers every binding in the builder, so a codelist another bound dataflow
|
|
146
|
+
shares keeps the codes that dataflow holds too, and a codelist a dataflow
|
|
147
|
+
given here with no binding enumerates stays full. A codelist the builder
|
|
148
|
+
holds as a partial is not cut again.
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
builder: The open builder of an unsealed edition.
|
|
152
|
+
source: Where the structures are: a `RestRegistry`, asked for each
|
|
153
|
+
dataflow's closure, or a sealed edition's `EditionRegistry`.
|
|
154
|
+
dataflows: The dataflows, by URN. A `latest` URN is filled at the
|
|
155
|
+
version it resolves to.
|
|
156
|
+
observations: The rows of each dataflow that has any, by URN string,
|
|
157
|
+
as `LocalRegistry.write_observations` reads them.
|
|
158
|
+
partials: Whether to cut codelists to partials.
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
The fingerprint of the full codelist each partial cut here was cut
|
|
162
|
+
from, by URN: ``seal``'s `partial_of`.
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
TypeError: If a URN names no dataflow at `source`.
|
|
166
|
+
ValueError: If a dataflow has no data structure at `source`, if
|
|
167
|
+
`observations` names a dataflow not in `dataflows`, or if a coded
|
|
168
|
+
column holds a value outside its codelist, naming the dataflow,
|
|
169
|
+
the component and the values.
|
|
170
|
+
"""
|
|
171
|
+
rows = dict(observations or {})
|
|
172
|
+
flows = _structures(source, dataflows, builder)
|
|
173
|
+
# Rows are found by the URN given or the one it resolved to.
|
|
174
|
+
keys = [{str(given), str(flow.urn)} for given, (flow, _) in zip(dataflows, flows, strict=True)]
|
|
175
|
+
unknown = sorted(set(rows) - set().union(*keys))
|
|
176
|
+
if unknown:
|
|
177
|
+
msg = f"observations name {', '.join(unknown)}, which is not among the dataflows built"
|
|
178
|
+
raise ValueError(msg)
|
|
179
|
+
found = [next((rows[key] for key in sorted(names) if key in rows), None) for names in keys]
|
|
180
|
+
_write(builder, flows, found)
|
|
181
|
+
return _cut(builder, flows) if partials else {}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
#: Classes a structure product never holds: it binds no dataflow (the sharded catalog spec §8).
|
|
185
|
+
_NOT_STRUCTURES: tuple[type, ...] = (Dataflow, DataflowBinding)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def fill_structures(
|
|
189
|
+
builder: LocalRegistry,
|
|
190
|
+
source: EditionRegistry,
|
|
191
|
+
*,
|
|
192
|
+
families: Collection[type[MaintainableArtefact]] = (),
|
|
193
|
+
agency: str | None = None,
|
|
194
|
+
ids: Collection[str] = (),
|
|
195
|
+
artefacts: Collection[SdmxUrn[MaintainableArtefact] | str] = (),
|
|
196
|
+
) -> tuple[str, ...]:
|
|
197
|
+
"""Copy full artefacts from `source` into an open builder, for a structure product.
|
|
198
|
+
|
|
199
|
+
An artefact is selected when `artefacts` names its URN, or when its class
|
|
200
|
+
is one of `families`, its agency is `agency` (any agency when None) and
|
|
201
|
+
its id matches one of the `ids` patterns (`fnmatch.fnmatchcase`, so
|
|
202
|
+
``SGC*``; any id when `ids` is empty). A family selects full artefacts
|
|
203
|
+
only, so a data edition holding partials can be the source. Nothing is
|
|
204
|
+
added for what a selected artefact references: each full artefact has one
|
|
205
|
+
structure home, so a reference into another structure product stays open.
|
|
206
|
+
The builder is the caller's to seal; an artefact it already holds at a
|
|
207
|
+
selected URN is replaced.
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
builder: The open builder of an unsealed edition.
|
|
211
|
+
source: The registry holding the full artefacts.
|
|
212
|
+
families: The artefact classes to select, such as `Codelist` or
|
|
213
|
+
`ConceptScheme`. `Codelist` selects geographic codelists too.
|
|
214
|
+
agency: The maintenance agency of the artefacts `families` selects.
|
|
215
|
+
ids: Patterns the id of an artefact `families` selects must match.
|
|
216
|
+
artefacts: More artefacts, by URN.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
The URNs copied, sorted.
|
|
220
|
+
|
|
221
|
+
Raises:
|
|
222
|
+
TypeError: If a family is not a class the store holds, or is
|
|
223
|
+
`Dataflow` or `DataflowBinding`.
|
|
224
|
+
ValueError: If a URN names a dataflow or a binding, if a URN
|
|
225
|
+
names an artefact `source` does not hold or holds as a partial, or
|
|
226
|
+
if nothing is selected.
|
|
227
|
+
"""
|
|
228
|
+
names: list[str] = []
|
|
229
|
+
for family in families:
|
|
230
|
+
name = CLASS_TO_NAME.get(family)
|
|
231
|
+
if name is None:
|
|
232
|
+
stored = next((cls.__name__ for cls in family.__mro__ if cls in CLASS_TO_NAME), None)
|
|
233
|
+
held_as = "" if stored is None else f"; it is stored as a {stored}, the family to name"
|
|
234
|
+
msg = f"{family.__name__} is not an artefact class the store holds{held_as}"
|
|
235
|
+
raise TypeError(msg)
|
|
236
|
+
if issubclass(family, _NOT_STRUCTURES):
|
|
237
|
+
msg = f"a structure product binds no dataflow, so it holds no {family.__name__}"
|
|
238
|
+
raise TypeError(msg)
|
|
239
|
+
names.append(name)
|
|
240
|
+
held = {
|
|
241
|
+
urn: (kind, owner, resource, partial)
|
|
242
|
+
for urn, kind, owner, resource, partial in source.connection.execute(
|
|
243
|
+
"SELECT urn, artefact_type, agency_id, resource_id, is_partial FROM sdmx.artefact"
|
|
244
|
+
).fetchall()
|
|
245
|
+
}
|
|
246
|
+
selected = {
|
|
247
|
+
urn
|
|
248
|
+
for urn, (kind, owner, resource, partial) in held.items()
|
|
249
|
+
if kind in names
|
|
250
|
+
and not partial
|
|
251
|
+
and (agency is None or owner == agency)
|
|
252
|
+
and (not ids or any(fnmatchcase(resource, pattern) for pattern in ids))
|
|
253
|
+
}
|
|
254
|
+
for named in artefacts:
|
|
255
|
+
urn = str(named)
|
|
256
|
+
found = held.get(urn)
|
|
257
|
+
if found is None:
|
|
258
|
+
msg = f"{urn} is not held at {source}"
|
|
259
|
+
raise ValueError(msg)
|
|
260
|
+
kind, _, _, partial = found
|
|
261
|
+
if kind in {CLASS_TO_NAME[cls] for cls in _NOT_STRUCTURES}:
|
|
262
|
+
msg = f"{urn} is a {kind}, and a structure product binds no dataflow"
|
|
263
|
+
raise ValueError(msg)
|
|
264
|
+
if partial:
|
|
265
|
+
msg = f"{urn} is a partial artefact at {source}; a structure product holds full artefacts"
|
|
266
|
+
raise ValueError(msg)
|
|
267
|
+
selected.add(urn)
|
|
268
|
+
if not selected:
|
|
269
|
+
msg = f"nothing at {source} matches families={sorted(names)}, agency={agency!r}, ids={sorted(ids)}"
|
|
270
|
+
raise ValueError(msg)
|
|
271
|
+
kept = sorted(selected)
|
|
272
|
+
copied = (source.get(SdmxUrn.parse(urn), expect=MaintainableArtefact, eager=True) for urn in kept)
|
|
273
|
+
builder.add_all([artefact for artefact in copied if artefact is not None])
|
|
274
|
+
return tuple(kept)
|
|
275
|
+
|
|
276
|
+
|
|
130
277
|
def table_for(urn: SdmxUrn[Dataflow]) -> str:
|
|
131
278
|
"""The lake table a dataflow's observations go in: its URN's parts, as an identifier."""
|
|
132
279
|
parts = f"{urn.agency}_{urn.id}_{urn.version}"
|
|
@@ -154,10 +301,19 @@ def _structures(
|
|
|
154
301
|
raise ValueError(msg)
|
|
155
302
|
flows.append((flow, structure))
|
|
156
303
|
if isinstance(source, RestRegistry):
|
|
157
|
-
#
|
|
158
|
-
|
|
159
|
-
|
|
304
|
+
# What was fetched and is new goes in, and what of it the closure does
|
|
305
|
+
# not reach comes out; then the closure's members the builder already
|
|
306
|
+
# held are replaced by the fetched ones. Into an empty builder this is
|
|
307
|
+
# every fetched artefact in, the rest of the closure out.
|
|
308
|
+
before = _held(edition)
|
|
309
|
+
fetched = list(source.registry)
|
|
310
|
+
edition.add_all([artefact for artefact in fetched if str(urn_of(artefact)) not in before])
|
|
311
|
+
closure = _closure(edition, flows)
|
|
312
|
+
for urn in _held(edition) - before - closure:
|
|
160
313
|
edition.drop(SdmxUrn.parse(urn))
|
|
314
|
+
replaced = [artefact for artefact in fetched if str(urn_of(artefact)) in before & closure]
|
|
315
|
+
if replaced:
|
|
316
|
+
edition.add_all(replaced)
|
|
161
317
|
else:
|
|
162
318
|
kept = sorted(_closure(source, flows))
|
|
163
319
|
copied = (source.get(SdmxUrn.parse(urn), expect=MaintainableArtefact, eager=True) for urn in kept)
|
|
@@ -178,11 +334,8 @@ def _closure(registry: EditionRegistry, flows: Iterable[tuple[Dataflow, DataStru
|
|
|
178
334
|
return {urn for flow, dsd in flows for urn in references.closure(str(flow.urn), [str(dsd.urn)])}
|
|
179
335
|
|
|
180
336
|
|
|
181
|
-
def _write(
|
|
182
|
-
|
|
183
|
-
) -> list[tuple[DataflowBinding, DataStructure]]:
|
|
184
|
-
"""Write each dataflow's rows to its own table and bind it; the bindings, located, with their structures."""
|
|
185
|
-
bound: list[tuple[DataflowBinding, DataStructure]] = []
|
|
337
|
+
def _write(edition: LocalRegistry, flows: list[tuple[Dataflow, DataStructure]], rows: list[WriteSource | None]) -> None:
|
|
338
|
+
"""Write each dataflow's rows to its own table and bind it."""
|
|
186
339
|
for (flow, dsd), found in zip(flows, rows, strict=True):
|
|
187
340
|
if found is None:
|
|
188
341
|
continue
|
|
@@ -190,27 +343,39 @@ def _write(
|
|
|
190
343
|
edition.write_observations(schema=SCHEMA, table=table, source=found)
|
|
191
344
|
binding = DataflowBinding.from_dsd(dsd, dataflow=Ref[Dataflow].unresolved(flow.urn), schema=SCHEMA, table=table)
|
|
192
345
|
edition.add(binding)
|
|
193
|
-
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def _bound(edition: LocalRegistry) -> list[tuple[Dataflow, DataflowBinding, DataStructure]]:
|
|
349
|
+
"""Every binding the builder holds, located, with its dataflow and data structure."""
|
|
350
|
+
bound: list[tuple[Dataflow, DataflowBinding, DataStructure]] = []
|
|
351
|
+
for binding in edition.get_all(DataflowBinding):
|
|
352
|
+
flow = edition.get(binding.dataflow.urn, expect=Dataflow)
|
|
353
|
+
dsd = None if flow is None else edition.dsd(flow.urn)
|
|
354
|
+
if flow is not None and dsd is not None:
|
|
355
|
+
bound.append((flow, edition.locate(binding), dsd))
|
|
194
356
|
return bound
|
|
195
357
|
|
|
196
358
|
|
|
197
|
-
def _cut(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
"""
|
|
359
|
+
def _cut(edition: LocalRegistry, flows: list[tuple[Dataflow, DataStructure]]) -> dict[str, str]:
|
|
360
|
+
"""Replace each codelist that can be cut by its partial; the full fingerprint of each, by URN.
|
|
361
|
+
|
|
362
|
+
The codes kept are those of every binding in the builder; a dataflow of
|
|
363
|
+
`flows` with no binding keeps the codelists it enumerates full.
|
|
364
|
+
"""
|
|
203
365
|
used: dict[str, set[str]] = {}
|
|
204
366
|
full: set[str] = set()
|
|
205
|
-
|
|
367
|
+
bound = _bound(edition)
|
|
368
|
+
observed = {str(flow.urn) for flow, _, _ in bound}
|
|
206
369
|
for flow, dsd in flows:
|
|
207
370
|
if str(flow.urn) not in observed:
|
|
208
371
|
full |= set(_components(dsd).values())
|
|
209
|
-
for binding, dsd in bound:
|
|
372
|
+
for _, binding, dsd in bound:
|
|
210
373
|
_observed_codes(edition, binding, dsd, used, full)
|
|
211
374
|
placed, referenced = _code_references(edition)
|
|
212
375
|
full |= placed
|
|
213
|
-
|
|
376
|
+
served = {str(flow.urn): (flow, dsd) for flow, dsd in flows}
|
|
377
|
+
served.update({str(flow.urn): (flow, dsd) for flow, _, dsd in bound})
|
|
378
|
+
for urn, codes in _constraint_codes(edition, list(served.values())).items():
|
|
214
379
|
used.setdefault(urn, set()).update(codes)
|
|
215
380
|
cut: dict[str, str] = {}
|
|
216
381
|
for urn in sorted(set(used) - full):
|