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

fix(cli/delete): skip references prompt if deleting an aspect #7220

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions metadata-ingestion/src/datahub/cli/delete_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,26 +181,31 @@ def delete(
entity_type = guess_entity_type(urn=urn)
logger.info(f"DataHub configured with {host}")

references_count, related_aspects = delete_references(
urn, dry_run=True, cached_session_host=(session, host)
)
remove_references: bool = False

if (not force) and references_count > 0:
click.echo(
f"This urn was referenced in {references_count} other aspects across your metadata graph:"
if not aspect_name:
references_count, related_aspects = delete_references(
urn, dry_run=True, cached_session_host=(session, host)
)
click.echo(
tabulate(
[x.values() for x in related_aspects],
["relationship", "entity", "aspect"],
tablefmt="grid",
remove_references: bool = False

if (not force) and references_count > 0:
click.echo(
f"This urn was referenced in {references_count} other aspects across your metadata graph:"
)
click.echo(
tabulate(
[x.values() for x in related_aspects],
["relationship", "entity", "aspect"],
tablefmt="grid",
)
)
remove_references = click.confirm(
"Do you want to delete these references?"
)
)
remove_references = click.confirm("Do you want to delete these references?")

if force or remove_references:
delete_references(urn, dry_run=False, cached_session_host=(session, host))
if force or remove_references:
delete_references(
urn, dry_run=False, cached_session_host=(session, host)
)

deletion_result: DeletionResult = delete_one_urn_cmd(
urn,
Expand Down