Skip to content

Commit

Permalink
rebased from main
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjqliu committed Mar 13, 2024
1 parent 5cf98c9 commit a7a54a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
7 changes: 0 additions & 7 deletions pyiceberg/catalog/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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}")

Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a7a54a8

Please sign in to comment.