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

Soda Checks fail | Missing key error on diagnostics object as a result of SodaCL test run #546

Closed
RobertLD opened this issue Dec 12, 2024 · 1 comment

Comments

@RobertLD
Copy link
Contributor

It seems like the issue might be related to an unpinned dependency or a change in the data structure. The method update_reason expects a scanned result containing a dictionary called diagnostics, which should have a key fail.

The use of [] index syntax will raise an exception if the key fail is missing. It would be safer to use the .get() method, which allows for a default value when the key is absent (e.g., diagnostics.get('fail')). However, the underlying issue seems to be that the fail key is no longer present, which might be due to an update in the structure or behavior of the data.


ERROR:root:Exception occurred
Traceback (most recent call last):
  File "/home/rderienzo/.local/lib/python3.11/site-packages/datacontract/data_contract.py", line 202, in test
    check_soda_execute(run, data_contract, server, self._spark, tmp_dir)
  File "/home/rderienzo/.local/lib/python3.11/site-packages/datacontract/engines/soda/check_soda_execute.py", line 133, in check_soda_execute
    update_reason(check, c)
  File "/home/rderienzo/.local/lib/python3.11/site-packages/datacontract/engines/soda/check_soda_execute.py", line 185, in update_reason
    if c["diagnostics"]["fail"] is not None:
       ~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'fail'
ERROR:root:'fail'

@RobertLD
Copy link
Contributor Author

Disregard this has been resolved here #540

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

No branches or pull requests

1 participant