Skip to content

Commit

Permalink
adding backticks to catalog
Browse files Browse the repository at this point in the history
Signed-off-by: Danny Farah <danny_farah@mckinsey.com>
  • Loading branch information
dannyrfar committed May 3, 2023
1 parent 7719e75 commit 9915bbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`"

Expand All @@ -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,
}
Expand Down

0 comments on commit 9915bbd

Please sign in to comment.