Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiceberg/catalog/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,4 +891,4 @@ def _add_property_prefix(prop: str) -> str:


def _remove_property_prefix(prop: str) -> str:
return prop.lstrip(PROPERTY_KEY_PREFIX)
return prop.removeprefix(PROPERTY_KEY_PREFIX)
20 changes: 20 additions & 0 deletions tests/catalog/test_dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,26 @@ def test_load_namespace_properties(_bucket_initialize: None, database_name: str)
assert v == test_properties[k]


@mock_aws
def test_load_namespace_properties_with_prefix_char_keys(_bucket_initialize: None, database_name: str) -> None:
# Property keys starting with a character in the "p." prefix (e.g. "p" or ".") must
# survive a round trip. The stored keys are prefixed with PROPERTY_KEY_PREFIX ("p."),
# so decoding must strip only that literal prefix, not any leading "p"/"." characters.
test_properties = {
"provider": "s3",
"path": f"s3://{BUCKET_NAME}/{database_name}.db",
"ppp": "3",
".hidden": "yes",
"comment": "not affected",
}
test_catalog = DynamoDbCatalog("test_ddb_catalog")
test_catalog.create_namespace(database_name, test_properties)
listed_properties = test_catalog.load_namespace_properties(database_name)
for k, v in test_properties.items():
assert k in listed_properties
assert listed_properties[k] == v


@mock_aws
def test_load_non_exist_namespace_properties(_bucket_initialize: None, database_name: str) -> None:
test_catalog = DynamoDbCatalog("test_ddb_catalog")
Expand Down