diff --git a/metadata-ingestion/src/datahub/cli/delete_cli.py b/metadata-ingestion/src/datahub/cli/delete_cli.py index 1a75459a92c5cf..8501cf71f0d544 100644 --- a/metadata-ingestion/src/datahub/cli/delete_cli.py +++ b/metadata-ingestion/src/datahub/cli/delete_cli.py @@ -1,8 +1,8 @@ import logging +import random from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import dataclass from datetime import datetime -from random import choices from typing import Dict, List, Optional import click @@ -457,11 +457,11 @@ def by_filter( click.echo("Found urns of multiple entity types") for entity_type, entity_urns in urns_by_type.items(): click.echo( - f"- {len(entity_urns)} {entity_type} urn(s). Sample: {choices(entity_urns, k=min(5, len(entity_urns)))}" + f"- {len(entity_urns)} {entity_type} urn(s). Sample: {random.sample(entity_urns, k=min(5, len(entity_urns)))}" ) else: click.echo( - f"Found {len(urns)} {entity_type} urn(s). Sample: {choices(urns, k=min(5, len(urns)))}" + f"Found {len(urns)} {entity_type} urn(s). Sample: {random.sample(urns, k=min(5, len(urns)))}" ) if not force and not dry_run: diff --git a/metadata-ingestion/src/datahub/cli/migrate.py b/metadata-ingestion/src/datahub/cli/migrate.py index ea5375c9471283..1bf1211674f596 100644 --- a/metadata-ingestion/src/datahub/cli/migrate.py +++ b/metadata-ingestion/src/datahub/cli/migrate.py @@ -179,7 +179,7 @@ def dataplatform2instance_func( if not force and not dry_run: # get a confirmation from the operator before proceeding if this is not a dry run - sampled_urns_to_migrate = random.choices( + sampled_urns_to_migrate = random.sample( urns_to_migrate, k=min(10, len(urns_to_migrate)) ) sampled_new_urns: List[str] = [ @@ -193,7 +193,7 @@ def dataplatform2instance_func( if key ] click.echo( - f"Will migrate {len(urns_to_migrate)} urns such as {random.choices(urns_to_migrate, k=min(10, len(urns_to_migrate)))}" + f"Will migrate {len(urns_to_migrate)} urns such as {random.sample(urns_to_migrate, k=min(10, len(urns_to_migrate)))}" ) click.echo(f"New urns will look like {sampled_new_urns}") click.confirm("Ok to proceed?", abort=True)