Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for reading datapackage #134

Merged
merged 6 commits into from
Nov 10, 2023

Conversation

nailend
Copy link
Collaborator

@nailend nailend commented Oct 5, 2023

Description

Just adds further information about which why the reading of the datapackage might not have worked. E.g which column could not be casted.

Type of change

New feature (non-breaking change which adds functionality)

Checklist:

Please tick or delete options that are not relevant.

  • New and adjusted code is formatted using the pre-commit hooks
  • New and existing unit tests pass locally with my changes
  • I have added new features/fixes to the CHANGELOG

@nailend nailend self-assigned this Oct 5, 2023
@nailend nailend requested a review from henhuy October 5, 2023 11:30
@henhuy
Copy link
Collaborator

henhuy commented Oct 6, 2023

I like the idea, but cannot test it - do you have an example?
Maybe even add a minimal test?

@nailend
Copy link
Collaborator Author

nailend commented Oct 11, 2023

For a minimal test, I would need to add a false datapackage to examples. This might be confusing.
The easiest way to check is by modifying an existing example e.g
investment_multi_period/datapackage.json. Change type of field name to integer for the bus.csv and then run the `test_example_datapackage_readability``

The new error message will look like this:

E               tableschema.exceptions.CastError: 
E               Metadata structure of resource `bus` does not match data structure. Check the column names, types and their order.
E               Field "name" can't cast value "bus0" for type "integer" with format "default"

@nailend
Copy link
Collaborator Author

nailend commented Nov 9, 2023

Can't think of a test without creating an example datapackage. Anyway, I am basically just appending the original error message to the tabular internal one. I will just merge this

@nailend nailend merged commit f4fdfa5 into dev Nov 10, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants