republicofdata-io / damn

The DAMN (Data Assets Metric Navigation) tool extracts and reports metrics about your data assets
https://pypi.org/project/damn-tool/
12 stars 0 forks source link

Gracefully fail when passing an non-existant asset name #31

Closed olivierdupuis closed 1 year ago

olivierdupuis commented 1 year ago

When running the show and metrics command, we need to pass an asset. It works well when that asset exists, but fails when it doesn't...

olivierdupuis@MacBook-Pro damn % sudo poetry run damn show gdelt/gdelt_gkg_artic
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/olivierdupuis/git/discursus/damn/.venv/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/olivierdupuis/git/discursus/damn/.venv/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/olivierdupuis/git/discursus/damn/.venv/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/olivierdupuis/git/discursus/damn/.venv/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/olivierdupuis/git/discursus/damn/.venv/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/olivierdupuis/git/discursus/damn/damn_tool/show.py", line 146, in show
    packaged_command_output = package_command_output('show', data)
  File "/Users/olivierdupuis/git/discursus/damn/damn_tool/utils/helpers.py", line 88, in package_command_output
    freshness_policy = asset_info['definition'].get('freshnessPolicy', None)
KeyError: 'definition'
olivierdupuis commented 1 year ago

31 - Gracefully fail when passing an non-existant asset name