Skip to content

Commit 0dc5408

Browse files
authored
[bug] [REST] Dont remove identifier root (#1172)
* dont remove identifier root * remove catalog in identifier tuple
1 parent aae39b5 commit 0dc5408

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pyiceberg/catalog/rest.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,7 @@ def _split_identifier_for_path(
409409
self, identifier: Union[str, Identifier, TableIdentifier], kind: IdentifierKind = IdentifierKind.TABLE
410410
) -> Properties:
411411
if isinstance(identifier, TableIdentifier):
412-
if identifier.namespace.root[0] == self.name:
413-
return {"namespace": NAMESPACE_SEPARATOR.join(identifier.namespace.root[1:]), kind.value: identifier.name}
414-
else:
415-
return {"namespace": NAMESPACE_SEPARATOR.join(identifier.namespace.root), kind.value: identifier.name}
412+
return {"namespace": NAMESPACE_SEPARATOR.join(identifier.namespace.root), kind.value: identifier.name}
416413
identifier_tuple = self._identifier_to_validated_tuple(identifier)
417414

418415
return {"namespace": NAMESPACE_SEPARATOR.join(identifier_tuple[:-1]), kind.value: identifier_tuple[-1]}
@@ -578,6 +575,7 @@ def _create_table(
578575
fresh_partition_spec = assign_fresh_partition_spec_ids(partition_spec, iceberg_schema, fresh_schema)
579576
fresh_sort_order = assign_fresh_sort_order_ids(sort_order, iceberg_schema, fresh_schema)
580577

578+
identifier = self._identifier_to_tuple_without_catalog(identifier)
581579
namespace_and_table = self._split_identifier_for_path(identifier)
582580
if location:
583581
location = location.rstrip("/")
@@ -659,6 +657,7 @@ def register_table(self, identifier: Union[str, Identifier], metadata_location:
659657
Raises:
660658
TableAlreadyExistsError: If the table already exists
661659
"""
660+
identifier = self._identifier_to_tuple_without_catalog(identifier)
662661
namespace_and_table = self._split_identifier_for_path(identifier)
663662
request = RegisterTableRequest(
664663
name=namespace_and_table["table"],

0 commit comments

Comments
 (0)