Skip to content

Commit 83e3412

Browse files
authored
Temporarily ignore MANAGED HMS tables on external storage location (#2837)
<!-- REMOVE IRRELEVANT COMMENTS BEFORE CREATING A PULL REQUEST --> ## Changes <!-- Summary of your changes that are easy to understand. Add screenshots when necessary --> ### Linked issues <!-- DOC: Link issue with a keyword: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved. See https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword --> Resolves #2838 ### Functionality - [ ] modified existing workflow: `...` ### Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [ ] added unit tests - [ ] added integration tests - [ ] verified on staging environment (screenshot attached)
1 parent b504be2 commit 83e3412

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/databricks/labs/ucx/hive_metastore/table_migrate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ def _sql_migrate_view(self, src_view: ViewToMigrate) -> str:
179179
return src_view.sql_migrate_view(self.index())
180180

181181
def _migrate_external_table(self, src_table: Table, rule: Rule):
182+
if src_table.object_type == "MANAGED":
183+
logger.warning(
184+
f"failed-to-migrate: Detected MANAGED table {src_table.name} on external storage, not currently "
185+
f"supported by UCX"
186+
)
187+
return False
182188
target_table_key = rule.as_uc_table_key
183189
table_migrate_sql = src_table.sql_migrate_external(target_table_key)
184190
logger.debug(f"Migrating external table {src_table.key} to using SQL query: {table_migrate_sql}")

tests/unit/hive_metastore/test_table_migrate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_migrate_dbfs_root_tables_should_produce_proper_queries(ws):
7070
)
7171
assert (
7272
"SYNC TABLE `ucx_default`.`db1_dst`.`managed_mnt` FROM `hive_metastore`.`db1_src`.`managed_mnt`;"
73-
in backend.queries
73+
not in backend.queries
7474
)
7575
assert (
7676
"ALTER TABLE `hive_metastore`.`db1_src`.`managed_dbfs` "
@@ -83,7 +83,7 @@ def test_migrate_dbfs_root_tables_should_produce_proper_queries(ws):
8383
) in backend.queries
8484
assert (
8585
"SYNC TABLE `ucx_default`.`db1_dst`.`managed_other` FROM `hive_metastore`.`db1_src`.`managed_other`;"
86-
in backend.queries
86+
not in backend.queries
8787
)
8888
migrate_grants.apply.assert_called()
8989

0 commit comments

Comments
 (0)