diff --git a/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py b/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py index 7d0490d45..5b9e83e57 100644 --- a/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py +++ b/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py @@ -6,7 +6,7 @@ from dataclasses import dataclass from functools import partial from operator import attrgetter -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union import pandas as pd from cachetools import Cache, cachedmethod @@ -439,7 +439,7 @@ def _exists(self) -> bool: """ if self._table.catalog: try: - self._get_spark().sql(f"USE CATALOG {self._table.catalog}") + self._get_spark().sql(f"USE CATALOG `{self._table.catalog}`") except (ParseException, AnalysisException) as exc: logger.warning( "catalog %s not found or unity not enabled. Error message: %s", diff --git a/kedro-datasets/tests/databricks/test_managed_table_dataset.py b/kedro-datasets/tests/databricks/test_managed_table_dataset.py index 000aa8d6e..fbdbaaebc 100644 --- a/kedro-datasets/tests/databricks/test_managed_table_dataset.py +++ b/kedro-datasets/tests/databricks/test_managed_table_dataset.py @@ -174,6 +174,11 @@ def test_full_table(self): unity_ds = ManagedTableDataSet(catalog="test", database="test", table="test") assert unity_ds._table.full_table_location() == "`test`.`test`.`test`" + unity_ds = ManagedTableDataSet( + catalog="test-test", database="test", table="test" + ) + assert unity_ds._table.full_table_location() == "`test-test`.`test`.`test`" + unity_ds = ManagedTableDataSet(database="test", table="test") assert unity_ds._table.full_table_location() == "`test`.`test`" @@ -192,7 +197,7 @@ def test_describe(self): "write_mode": "overwrite", "dataframe_type": "spark", "primary_key": None, - "version": None, + "version": "None", "owner_group": None, "partition_columns": None, }