ONSdigital / csvcubed

A CLI to build linked data cubes.
https://gss-cogs.github.io/csvcubed-docs/external/
Apache License 2.0
12 stars 1 forks source link

Using old version of csvcubed with new $schema #884

Open SarahJohnsonONS opened 1 year ago

SarahJohnsonONS commented 1 year ago

When running an outdated version of csvcubed referencing a new version of the cube-config schema, the following error is raised:

2023-08-29 12:38:06,588 - csvcubed.cli.entrypoint - CRITICAL - Traceback (most recent call last):
  File "/Users/waf/.pyenv/versions/3.11.1/lib/python3.11/site-packages/csvcubed/cli/entrypoint.py", line 103, in build_command
    build_csvw(
  File "/Users/waf/.pyenv/versions/3.11.1/lib/python3.11/site-packages/csvcubed/cli/buildcsvw/build.py", line 32, in build_csvw
    cube, json_schema_validation_errors, validation_errors = _extract_and_validate_cube(
                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/waf/.pyenv/versions/3.11.1/lib/python3.11/site-packages/csvcubed/cli/buildcsvw/build.py", line 66, in _extract_and_validate_cube
    deserialiser = _get_versioned_deserialiser(config_path)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/waf/.pyenv/versions/3.11.1/lib/python3.11/site-packages/csvcubed/cli/buildcsvw/build.py", line 86, in _get_versioned_deserialiser
    return get_deserialiser_for_schema(config.get("$schema"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/waf/.pyenv/versions/3.11.1/lib/python3.11/site-packages/csvcubed/readers/cubeconfig/schema_versions.py", line 88, in get_deserialiser_for_schema
    schema_version_major, schema_version_minor = _get_schema_version(schema_path)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/waf/.pyenv/versions/3.11.1/lib/python3.11/site-packages/csvcubed/readers/cubeconfig/schema_versions.py", line 134, in _get_schema_version
    raise ValueError(
ValueError: The $schema 'https://purl.org/csv-cubed/qube-config/v1.5' referenced in the cube config file is not recognised. Please check for any updates to your csvcubed installation.
 (log.py:95)

Create a new error to catch this and verify if the user should update csvcubed or use a locally hosted version of the cube-config schema that is supported by the currently-installed version of csvcubed.

Update documentation with a new error entry on how to update csvcubed to use the correct version, when using a newer version of the cube config schema against an older version of csvcubed.

canwaf commented 1 year ago

"The newest version of qube-config schema that should be able to be run by a given version of csvcubed cubed is the one that is distributed with csvcubed."