Skip to content

Commit 35f1ef0

Browse files
remove catalog requirement in get_tables
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 390f592 commit 35f1ef0

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

src/databricks/sql/backend/sea/backend.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,9 +695,6 @@ def get_tables(
695695
table_types: Optional[List[str]] = None,
696696
) -> "ResultSet":
697697
"""Get tables by executing 'SHOW TABLES IN catalog [SCHEMA LIKE pattern] [LIKE pattern]'."""
698-
if not catalog_name:
699-
raise ValueError("Catalog name is required for get_tables")
700-
701698
operation = (
702699
MetadataCommands.SHOW_TABLES_ALL_CATALOGS.value
703700
if catalog_name in [None, "*", "%"]

src/databricks/sql/backend/sea/utils/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class MetadataCommands(Enum):
6060
SHOW_TABLES_ALL_CATALOGS = "SHOW TABLES IN ALL CATALOGS"
6161
SHOW_COLUMNS = "SHOW COLUMNS IN CATALOG {}"
6262

63-
SCHEMA_LIKE_PATTERN = " SCHEMA LIKE '{}'"
64-
TABLE_LIKE_PATTERN = " TABLE LIKE '{}'"
6563
LIKE_PATTERN = " LIKE '{}'"
64+
SCHEMA_LIKE_PATTERN = " SCHEMA" + LIKE_PATTERN
65+
TABLE_LIKE_PATTERN = " TABLE" + LIKE_PATTERN
6666

6767
CATALOG_SPECIFIC = "CATALOG {}"

tests/unit/test_sea_backend.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -810,16 +810,6 @@ def test_get_tables(self, sea_client, sea_session_id, mock_cursor):
810810
enforce_embedded_schema_correctness=False,
811811
)
812812

813-
# Case 4: Without catalog name (should raise ValueError)
814-
with pytest.raises(ValueError) as excinfo:
815-
sea_client.get_tables(
816-
session_id=sea_session_id,
817-
max_rows=100,
818-
max_bytes=1000,
819-
cursor=mock_cursor,
820-
)
821-
assert "Catalog name is required for get_tables" in str(excinfo.value)
822-
823813
def test_get_columns(self, sea_client, sea_session_id, mock_cursor):
824814
"""Test the get_columns method with various parameter combinations."""
825815
# Mock the execute_command method

0 commit comments

Comments
 (0)