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