From 0dc54080aa287dc8e920da128d7f4b335965f1df Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Fri, 13 Sep 2024 09:36:01 -0700 Subject: [PATCH] [bug] [REST] Dont remove identifier root (#1172) * dont remove identifier root * remove catalog in identifier tuple --- pyiceberg/catalog/rest.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyiceberg/catalog/rest.py b/pyiceberg/catalog/rest.py index dbceaa346..20a04d9c5 100644 --- a/pyiceberg/catalog/rest.py +++ b/pyiceberg/catalog/rest.py @@ -409,10 +409,7 @@ def _split_identifier_for_path( self, identifier: Union[str, Identifier, TableIdentifier], kind: IdentifierKind = IdentifierKind.TABLE ) -> Properties: if isinstance(identifier, TableIdentifier): - if identifier.namespace.root[0] == self.name: - return {"namespace": NAMESPACE_SEPARATOR.join(identifier.namespace.root[1:]), kind.value: identifier.name} - else: - return {"namespace": NAMESPACE_SEPARATOR.join(identifier.namespace.root), kind.value: identifier.name} + return {"namespace": NAMESPACE_SEPARATOR.join(identifier.namespace.root), kind.value: identifier.name} identifier_tuple = self._identifier_to_validated_tuple(identifier) return {"namespace": NAMESPACE_SEPARATOR.join(identifier_tuple[:-1]), kind.value: identifier_tuple[-1]} @@ -578,6 +575,7 @@ def _create_table( fresh_partition_spec = assign_fresh_partition_spec_ids(partition_spec, iceberg_schema, fresh_schema) fresh_sort_order = assign_fresh_sort_order_ids(sort_order, iceberg_schema, fresh_schema) + identifier = self._identifier_to_tuple_without_catalog(identifier) namespace_and_table = self._split_identifier_for_path(identifier) if location: location = location.rstrip("/") @@ -659,6 +657,7 @@ def register_table(self, identifier: Union[str, Identifier], metadata_location: Raises: TableAlreadyExistsError: If the table already exists """ + identifier = self._identifier_to_tuple_without_catalog(identifier) namespace_and_table = self._split_identifier_for_path(identifier) request = RegisterTableRequest( name=namespace_and_table["table"],