You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by fo...@apache.org on 2026/08/15 20:01:18 UTC

(iceberg-python) branch main updated: fix: Removeprefix for namespace property keys (#3602)

This is an automated email from the ASF dual-hosted git repository.

Fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git


The following commit(s) were added to refs/heads/main by this push:
     new 3170c4fdd fix: Removeprefix for namespace property keys (#3602)
3170c4fdd is described below

commit 3170c4fdd04eaf64e7c42c853afb918337e81fcb
Author: Anas Khan <an...@gmail.com>
AuthorDate: Sun Aug 16 01:31:12 2026 +0530

    fix: Removeprefix for namespace property keys (#3602)
    
    fix: decode DynamoDB namespace property keys with removeprefix
    
    Use str.removeprefix directly when decoding namespace properties so the literal p. prefix is removed without stripping leading property-key characters.
    
    Signed-off-by: Anas Khan <83...@users.noreply.github.com>
---
 pyiceberg/catalog/dynamodb.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/pyiceberg/catalog/dynamodb.py b/pyiceberg/catalog/dynamodb.py
index 74c0be6c9..10f74fb9a 100644
--- a/pyiceberg/catalog/dynamodb.py
+++ b/pyiceberg/catalog/dynamodb.py
@@ -837,7 +837,10 @@ CREATE_CATALOG_GLOBAL_SECONDARY_INDEXES = [
 
 
 def _get_namespace_properties(namespace_dict: dict[str, str]) -> Properties:
-    return {_remove_property_prefix(key): val for key, val in namespace_dict.items() if key.startswith(PROPERTY_KEY_PREFIX)}
+    # removeprefix removes the literal prefix, unlike lstrip which removes any leading prefix characters
+    return {
+        key.removeprefix(PROPERTY_KEY_PREFIX): val for key, val in namespace_dict.items() if key.startswith(PROPERTY_KEY_PREFIX)
+    }
 
 
 def _convert_dynamo_item_to_regular_dict(dynamo_json: dict[str, Any]) -> dict[str, str]:
@@ -888,7 +891,3 @@ def _convert_dynamo_item_to_regular_dict(dynamo_json: dict[str, Any]) -> dict[st
 
 def _add_property_prefix(prop: str) -> str:
     return PROPERTY_KEY_PREFIX + prop
-
-
-def _remove_property_prefix(prop: str) -> str:
-    return prop.lstrip(PROPERTY_KEY_PREFIX)