Skip to content

Commit

Permalink
Introduce and tested CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
FastLee committed Oct 21, 2024
1 parent 7ecf784 commit 48022f4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/databricks/labs/ucx/contexts/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ def acl_migrator(self):
self.migration_status_refresher,
self.migrate_grants,
self.sql_backend,
self.config.ucx_catalog,
self.config.inventory_database,
)

Expand Down
3 changes: 1 addition & 2 deletions src/databricks/labs/ucx/hive_metastore/grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,14 +843,13 @@ def __init__(
migration_status_refresher: TableMigrationStatusRefresher,
migrate_grants: MigrateGrants,
backend: SqlBackend,
catalog: str,
schema: str,
):
self._table_crawler = tables_crawler
self._workspace_info = workspace_info
self._migration_status_refresher = migration_status_refresher
self._migrate_grants = migrate_grants
super().__init__(backend, catalog, schema, "acls", Grant)
super().__init__(backend, "hive_metastore", schema, "acls", Grant)

def migrate_acls(self, *, target_catalog: str | None = None, hms_fed: bool = False) -> None:
workspace_name = self._workspace_info.current()
Expand Down
7 changes: 3 additions & 4 deletions tests/unit/hive_metastore/test_migrate_acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_migrate_acls_should_produce_proper_queries(ws, ws_info, mock_backend, c

migrate_grants = create_autospec(MigrateGrants)
acl_migrate = ACLMigrator(
table_crawler, workspace_info, migration_status_refresher, migrate_grants, mock_backend, "hive_metastore", "ucx"
table_crawler, workspace_info, migration_status_refresher, migrate_grants, mock_backend, "ucx"
)
migration_status_refresher.get_seen_tables.return_value = {
"ucx_default.db1_dst.view_dst": "hive_metastore.db1_src.view_src",
Expand Down Expand Up @@ -68,7 +68,6 @@ def test_migrate_acls_hms_fed_proper_queries(ws, ws_info, mock_backend, caplog):
migration_status_refresher,
migrate_grants,
mock_backend,
"hive_metastore",
"ucx",
)
acl_migrate.migrate_acls(hms_fed=True, target_catalog='hms_fed')
Expand Down Expand Up @@ -123,10 +122,10 @@ def grant_loader():
migration_status_refresher.index.return_value = migration_index

acl_migrate = ACLMigrator(
table_crawler, workspace_info, migration_status_refresher, migrate_grants, sql_backend, "hive_metastore", "ucx"
table_crawler, workspace_info, migration_status_refresher, migrate_grants, sql_backend, "ucx"
)
tacls = acl_migrate.snapshot()
sql_backend.fetch.assert_called_with('SELECT * FROM `hive_metastore`.`ucx`.`ACLS`')
sql_backend.fetch.assert_called_with('SELECT * FROM `hive_metastore`.`ucx`.`acls`')
for grant in user_grants:
assert grant in tacls
assert Grant('acc_group1', 'SELECT', database='db1_src', table='table1') in tacls
Expand Down

0 comments on commit 48022f4

Please sign in to comment.