datahub icon indicating copy to clipboard operation
datahub copied to clipboard

DataHub CLI: Error while invoking dataset get command

Open Linux-oiD opened this issue 2 months ago • 2 comments

Describe the bug When I try to export dataset definition to Yaml file via CLI, I get a local variable python error. I tried to use a datahub CLI inside the DH actions container (deployed VIA official Helm Chart, actively used for ingestions) but got the same error. To Reproduce Steps to reproduce the behavior:

  1. configure Datahub CLI via datahub init
  2. invoke datahub dataset get --urn "urn:li:dataset:(urn:li:dataPlatform:bigquery,******,PROD)" --to-file dataset.yaml
  3. Recieve an error:
Traceback (most recent call last):
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/datahub/entrypoints.py", line 231, in main
    sys.exit(datahub(standalone_mode=False, **kwargs))
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/datahub/upgrade/upgrade.py", line 435, in async_wrapper
    ret = func(*args, **kwargs)
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/datahub/telemetry/telemetry.py", line 476, in wrapper
    raise e
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/datahub/telemetry/telemetry.py", line 424, in wrapper
    res = func(*args, **kwargs)
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/datahub/cli/specific/dataset_cli.py", line 56, in get
    dataset: Dataset = Dataset.from_datahub(graph=graph, urn=urn)
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/datahub/api/entities/dataset/dataset.py", line 953, in from_datahub
    schema=Dataset._schema_from_schema_metadata(graph, urn),
  File "/datahub-ingestion/.venv/lib/python3.10/site-packages/datahub/api/entities/dataset/dataset.py", line 865, in _schema_from_schema_metadata
    if schema_fields and schema_specification.fields:
UnboundLocalError: local variable 'schema_fields' referenced before assignment

Expected behaviour Get a dataset.yaml with all metadata Screenshots

Environment:

  • OS: Official DH actions container deployed via official Helm Chart
  • DH Version: 1.3.0
  • DH CLI Version: 1.3.0

Linux-oiD avatar Oct 20 '25 15:10 Linux-oiD

Hi, Can you double check the version? I checked 1.3.0 as well as the published actions image, and don't see the code matching the line numbers per your stack trace. I couldn't reproduce this with 1.3.0.

chakru-r avatar Oct 23 '25 14:10 chakru-r

@Linux-oiD , did the suggestion worked for you ?

deepgarg760 avatar Dec 04 '25 12:12 deepgarg760