Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
FastLee committed Oct 24, 2024
1 parent 20a4a96 commit ce9455a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions labs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ commands:
- name: migrate-acls
description: |
Migrate access control lists from legacy metastore to UC metastore.
Use the --dry-run flag to populate the infered_grants table and skip the migration.
Use the hms-fed flag to migrate HMS-FED ACLs. If not provided, HMS ACLs will be migrated for migrated tables.
flags:
- name: target-catalog
description: (Optional) Target catalog to migrate ACLs to. Used for HMS-FED ACLs migration.
Expand Down
11 changes: 7 additions & 4 deletions src/databricks/labs/ucx/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from databricks.labs.ucx.install import AccountInstaller
from databricks.labs.ucx.source_code.linters.files import LocalCodeLinter


ucx = App(__file__)
logger = get_logger(__file__)

Expand Down Expand Up @@ -705,7 +704,6 @@ def migrate_acls(
workspace_contexts = [ctx]
else:
workspace_contexts = _get_workspace_contexts(w, a, run_as_collection, **named_parameters)
current_ws_context = WorkspaceContext(w)
target_catalog = named_parameters.get("target_catalog")
hms_fed = named_parameters.get("hms_fed", False)
dry_run = named_parameters.get("dry_run", False)
Expand All @@ -716,10 +714,15 @@ def migrate_acls(
total_grants += len(grants)
logger.info(
f"Dry run completed. Found {total_grants} grants. The crawled grants can be found in the 'inferred_grants' table. "
f"The URL for the grants table: {w.config.host}/explore/data/hive_metastore/"
f"{current_ws_context.config.inventory_database}/inferred_grants "
"No changes were made."
)
urls: str = ""
for workspace_context in workspace_contexts:
urls += (
f"{workspace_context.connect_config.host}/explore/data/hive_metastore/"
f"{workspace_context.config.inventory_database}/inferred_grants\n"
)
logger.info(f"URLs to the inferred grants tables: \n{urls}")
return
for workspace_context in workspace_contexts:
workspace_context.acl_migrator.migrate_acls(target_catalog=target_catalog, hms_fed=hms_fed)
Expand Down

0 comments on commit ce9455a

Please sign in to comment.