Skip to content

Commit 6359561

Browse files
committed
Catalog test fixes
1 parent 10e1763 commit 6359561

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

pyiceberg/catalog/rest/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ def _create_table(
790790
if location:
791791
location = location.rstrip("/")
792792
request = CreateTableRequest(
793-
name=namespace_and_table["table"],
793+
name=self._identifier_to_validated_tuple(identifier)[-1],
794794
location=location,
795795
table_schema=fresh_schema,
796796
partition_spec=fresh_partition_spec,
@@ -869,7 +869,7 @@ def register_table(self, identifier: str | Identifier, metadata_location: str) -
869869
self._check_endpoint(Capability.V1_REGISTER_TABLE)
870870
namespace_and_table = self._split_identifier_for_path(identifier)
871871
request = RegisterTableRequest(
872-
name=namespace_and_table["table"],
872+
name=self._identifier_to_validated_tuple(identifier)[-1],
873873
metadata_location=metadata_location,
874874
)
875875
serialized_json = request.model_dump_json().encode(UTF8)

tests/integration/test_catalog.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ def test_incompatible_partitioned_schema_evolution(
674674
@pytest.mark.integration
675675
@pytest.mark.parametrize("test_catalog", CATALOGS)
676676
def test_namespace_with_slash(test_catalog: Catalog) -> None:
677-
if isinstance(test_catalog, (HiveCatalog, SqlCatalog, RestCatalog)):
677+
if isinstance(test_catalog, HiveCatalog):
678678
pytest.skip(f"{type(test_catalog).__name__} does not support slash in namespace")
679679

680680
namespace = ("new/db",)
@@ -716,7 +716,7 @@ def test_incompatible_sorted_schema_evolution(
716716
)
717717

718718
def test_namespace_with_dot(test_catalog: Catalog) -> None:
719-
if isinstance(test_catalog, (HiveCatalog, SqlCatalog, RestCatalog)):
719+
if isinstance(test_catalog, (HiveCatalog, SqlCatalog)):
720720
pytest.skip(f"{type(test_catalog).__name__} does not support dot in namespace")
721721

722722
namespace = ("new.db",)
@@ -730,7 +730,11 @@ def test_namespace_with_dot(test_catalog: Catalog) -> None:
730730
assert test_catalog.namespace_exists(namespace)
731731

732732
# list_namespaces returns a list of tuples
733-
assert namespace in test_catalog.list_namespaces()
733+
if isinstance(test_catalog, RestCatalog):
734+
namespaces = test_catalog.list_namespaces()
735+
assert ("new",) in namespaces or ("new.db",) in namespaces
736+
else:
737+
assert namespace in test_catalog.list_namespaces()
734738

735739
properties = test_catalog.load_namespace_properties(namespace)
736740
assert properties is not None
@@ -742,7 +746,7 @@ def test_namespace_with_dot(test_catalog: Catalog) -> None:
742746
@pytest.mark.integration
743747
@pytest.mark.parametrize("test_catalog", CATALOGS)
744748
def test_table_name_with_slash(test_catalog: Catalog, table_schema_simple: Schema) -> None:
745-
if isinstance(test_catalog, (HiveCatalog, SqlCatalog, RestCatalog)):
749+
if isinstance(test_catalog, (HiveCatalog, SqlCatalog)):
746750
pytest.skip(f"{type(test_catalog).__name__} does not support slash in table name")
747751

748752
namespace = ("ns_slash",)
@@ -769,7 +773,7 @@ def test_table_name_with_slash(test_catalog: Catalog, table_schema_simple: Schem
769773
@pytest.mark.integration
770774
@pytest.mark.parametrize("test_catalog", CATALOGS)
771775
def test_table_name_with_dot(test_catalog: Catalog, table_schema_simple: Schema) -> None:
772-
if isinstance(test_catalog, (HiveCatalog, SqlCatalog, RestCatalog)):
776+
if isinstance(test_catalog, (HiveCatalog, SqlCatalog)):
773777
pytest.skip(f"{type(test_catalog).__name__} does not support dot in table name")
774778

775779
namespace = ("ns_dot",)

0 commit comments

Comments
 (0)