Skip to content

[v1.0-rc/bug] datahub-cli throws an error when trying to write dataset to file #13065

@ibzx

Description

@ibzx

Describe the bug
A clear and concise description of what the bug is.

When running the CLI command

datahub dataset get --urn "urn:li:dataset:(urn:li:dataPlatform:iceberg,open_h3.37546565-8bf8-435a-bb31-ca220244798d,PROD)" --to-file t.yaml

I receive the error

(open-h3) kevin@kevin-desktop ~/w/tmp> datahub dataset get --urn "urn:li:dataset:(urn:li:dataPlatform:iceberg,open_h3.37546565-8bf8-435a-bb31-ca220244798d,PROD)" --to-file t.yaml
/home/kevin/venv/open-h3/lib/python3.11/site-packages/pydantic/_internal/_config.py:345: UserWarning: Valid config keys have changed in V2:
* 'allow_population_by_field_name' has been renamed to 'populate_by_name'
  warnings.warn(message, UserWarning)
[2025-04-02 17:01:40,543] ERROR    {datahub.entrypoints:244} - Command failed: 'NoneType' object has no attribute 'add'
Traceback (most recent call last):
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/datahub/entrypoints.py", line 231, in main
    sys.exit(datahub(standalone_mode=False, **kwargs))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/datahub/upgrade/upgrade.py", line 435, in async_wrapper
    ret = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/datahub/telemetry/telemetry.py", line 476, in wrapper
    raise e
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/datahub/telemetry/telemetry.py", line 424, in wrapper
    res = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/datahub/cli/specific/dataset_cli.py", line 61, in get
    f"{json.dumps(dataset.dict(exclude_unset=True, exclude_none=True), indent=2)}"
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/pydantic/main.py", line 1171, in dict
    return self.model_dump(
           ^^^^^^^^^^^^^^^^
  File "/home/kevin/venv/open-h3/lib/python3.11/site-packages/datahub/api/entities/dataset/dataset.py", line 993, in model_dump
    exclude.add("subtypes")
    ^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'add'

It can be traced back to this code

should be modified to

exclude = kwargs.pop("exclude", set()) or set()

To Reproduce
Unknown if this is specific to our instance of datahub/dataset or a generalized bug

Metadata

Metadata

Labels

bugBug reportdatahub-v1.0-rcIssue or PR related to DataHub v1.0 Release Candidates

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions