From a7a54a8fe114188259af6667e3ec5d467e4a075a Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 13 Mar 2024 08:15:21 -0700 Subject: [PATCH] rebased from main --- pyiceberg/catalog/sql.py | 7 ------- tests/cli/test_console.py | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/pyiceberg/catalog/sql.py b/pyiceberg/catalog/sql.py index bb42cd3b37..332e75d4a9 100644 --- a/pyiceberg/catalog/sql.py +++ b/pyiceberg/catalog/sql.py @@ -174,9 +174,6 @@ def create_table( schema: Schema = self._convert_schema_if_needed(schema) # type: ignore database_name, table_name = self.identifier_to_database_and_table(identifier) - if not self._namespace_exists(database_name): - self.create_namespace(database_name) - location = self._resolve_table_location(location, database_name, table_name) metadata_location = self._get_metadata_location(location=location) metadata = new_table_metadata( @@ -539,10 +536,6 @@ def list_namespaces(self, namespace: Union[str, Identifier] = ()) -> List[Identi Raises: NoSuchNamespaceError: If a namespace with the given name does not exist. """ - # Hierarchical namespace is not supported. Return an empty list - if namespace: - return [] - if namespace and not self._namespace_exists(namespace): raise NoSuchNamespaceError(f"Namespace does not exist: {namespace}") diff --git a/tests/cli/test_console.py b/tests/cli/test_console.py index b02d2ada13..845b4694c6 100644 --- a/tests/cli/test_console.py +++ b/tests/cli/test_console.py @@ -386,7 +386,7 @@ def test_rename_table_does_not_exists(catalog: Catalog) -> None: runner = CliRunner() result = runner.invoke(run, ["rename", "default.doesnotexist", "default.bar"]) assert result.exit_code == 1 - assert result.output == "Namespace does not exist: default\n" + assert result.output == "Table does not exist: ('default', 'doesnotexist')\n" def test_properties_get_table(catalog: Catalog) -> None: @@ -797,7 +797,7 @@ def test_json_rename_table_does_not_exists(catalog: Catalog) -> None: runner = CliRunner() result = runner.invoke(run, ["--output=json", "rename", "default.doesnotexist", "default.bar"]) assert result.exit_code == 1 - assert result.output == """{"type": "NoSuchNamespaceError", "message": "Namespace does not exist: default"}\n""" + assert result.output == """{"type": "NoSuchTableError", "message": "Table does not exist: ('default', 'doesnotexist')"}\n""" def test_json_properties_get_table(catalog: Catalog) -> None: