diff --git a/src/databricks/labs/ucx/hive_metastore/mapping.py b/src/databricks/labs/ucx/hive_metastore/mapping.py index c87e7406e1..8f8e08b1f5 100644 --- a/src/databricks/labs/ucx/hive_metastore/mapping.py +++ b/src/databricks/labs/ucx/hive_metastore/mapping.py @@ -133,7 +133,7 @@ def skip_table_or_view(self, schema_name: str, table_name: str, load_table: Call if table is None: raise NotFound("[TABLE_OR_VIEW_NOT_FOUND]") self._sql_backend.execute( - f"ALTER {table.kind} {escape_sql_identifier(schema_name)}.{escape_sql_identifier(table_name)} SET TBLPROPERTIES('{self.UCX_SKIP_PROPERTY}' = true)" + f"ALTER {table.kind} {escape_sql_identifier(table.full_name)} SET TBLPROPERTIES('{self.UCX_SKIP_PROPERTY}' = true)" ) except NotFound as err: if "[TABLE_OR_VIEW_NOT_FOUND]" in str(err) or "[DELTA_TABLE_NOT_FOUND]" in str(err): diff --git a/tests/unit/hive_metastore/test_mapping.py b/tests/unit/hive_metastore/test_mapping.py index 01944256f6..a7fcf7dd3b 100644 --- a/tests/unit/hive_metastore/test_mapping.py +++ b/tests/unit/hive_metastore/test_mapping.py @@ -208,15 +208,15 @@ def test_skip_happy_path(caplog): mapping.skip_table_or_view(schema_name="schema", table_name="table", load_table=lambda _schema, _table: table) ws.tables.get.assert_not_called() sbe.execute.assert_called_with( - f"ALTER TABLE `schema`.`table` SET TBLPROPERTIES('{mapping.UCX_SKIP_PROPERTY}' = true)" + f"ALTER TABLE `catalog`.`schema`.`table` SET TBLPROPERTIES('{mapping.UCX_SKIP_PROPERTY}' = true)" ) view = Table( - catalog="catalog", database="schema", name="table", object_type="table", table_format="csv", view_text="stuff" + catalog="catalog", database="schema", name="view", object_type="table", table_format="csv", view_text="stuff" ) mapping.skip_table_or_view(schema_name="schema", table_name="view", load_table=lambda _schema, _table: view) ws.tables.get.assert_not_called() sbe.execute.assert_called_with( - f"ALTER VIEW `schema`.`view` SET TBLPROPERTIES('{mapping.UCX_SKIP_PROPERTY}' = true)" + f"ALTER VIEW `catalog`.`schema`.`view` SET TBLPROPERTIES('{mapping.UCX_SKIP_PROPERTY}' = true)" ) assert len(caplog.records) == 0 mapping.skip_schema(schema="schema")