Skip to content

Commit

Permalink
code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal committed Jul 2, 2024
1 parent 9ef2490 commit 9bd41d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/how/updating-datahub.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This file documents any backwards-incompatible changes in DataHub and assists pe

- Protobuf CLI will no longer create binary encoded protoc custom properties. Flag added `-protocProp` in case this
behavior is required.
- `datahub get ...` CLI output format changed a bit. To use the older output format pass `datahub get -v 1 ...`
- `datahub get ...` CLI output format changed a bit. To use the older output format pass `datahub get --no-details ...`

### Potential Downtime

Expand Down
4 changes: 2 additions & 2 deletions metadata-ingestion/src/datahub/cli/cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def get_aspects_for_entity(
aspects: List[str],
typed: bool = False,
cached_session_host: Optional[Tuple[Session, str]] = None,
version: int = 1,
details: bool = False,
) -> Dict[str, Union[dict, _Aspect]]:
# Process non-timeseries aspects
non_timeseries_aspects = [a for a in aspects if a not in TIMESERIES_ASPECT_MAP]
Expand Down Expand Up @@ -554,7 +554,7 @@ def get_aspects_for_entity(
aspect_name
)

if version == 2:
if details:
aspect_dict = a
for k in ["name", "version", "type"]:
del aspect_dict[k]
Expand Down
13 changes: 6 additions & 7 deletions metadata-ingestion/src/datahub/cli/get_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ def get() -> None:
@click.option("--urn", required=False, type=str)
@click.option("-a", "--aspect", required=False, multiple=True, type=str)
@click.option(
"-v",
"--version",
"--details/--no-details",
required=False,
type=int,
default=2,
help="Version of get CLI to use.",
is_flag=True,
default=True,
help="Whether to .",
)
@click.pass_context
@upgrade.check_upgrade
@telemetry.with_telemetry()
def urn(ctx: Any, urn: Optional[str], aspect: List[str], version: int) -> None:
def urn(ctx: Any, urn: Optional[str], aspect: List[str], details: bool) -> None:
"""
Get metadata for an entity with an optional list of aspects to project.
This works for both versioned aspects and timeseries aspects. For timeseries aspects, it fetches the latest value.
Expand All @@ -48,7 +47,7 @@ def urn(ctx: Any, urn: Optional[str], aspect: List[str], version: int) -> None:
click.echo(
json.dumps(
get_aspects_for_entity(
entity_urn=urn, aspects=aspect, typed=False, version=version
entity_urn=urn, aspects=aspect, typed=False, details=details
),
sort_keys=True,
indent=2,
Expand Down

0 comments on commit 9bd41d2

Please sign in to comment.