Skip to content

Commit 220054d

Browse files
committed
show key when none
1 parent 546262e commit 220054d

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

pyiceberg/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464

6565
def transform_dict_value_to_str(dict: Dict[str, Any]) -> Dict[str, str]:
6666
"""Transform all values in the dictionary to string. Raise an error if any value is None."""
67-
for value in dict.values():
67+
for key, value in dict.items():
6868
if value is None:
69-
raise ValueError("None type is not a supported value in properties")
69+
raise ValueError(f"None type is not a supported value in properties: {key}")
7070
return {k: str(v) for k, v in dict.items()}
7171

7272

tests/catalog/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,4 +678,4 @@ def test_table_properties_raise_for_none_value(catalog: InMemoryCatalog) -> None
678678
property_with_none = {"property_name": None}
679679
with pytest.raises(ValidationError) as exc_info:
680680
_ = given_catalog_has_a_table(catalog, properties=property_with_none)
681-
assert "None type is not a supported value in properties" in str(exc_info.value)
681+
assert "None type is not a supported value in properties: property_name" in str(exc_info.value)

tests/catalog/test_sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,4 +951,4 @@ def test_table_properties_raise_for_none_value(
951951
property_with_none = {"property_name": None}
952952
with pytest.raises(ValidationError) as exc_info:
953953
_ = catalog.create_table(random_identifier, table_schema_simple, properties=property_with_none)
954-
assert "None type is not a supported value in properties" in str(exc_info.value)
954+
assert "None type is not a supported value in properties: property_name" in str(exc_info.value)

tests/integration/test_writes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,4 +688,4 @@ def test_table_properties_raise_for_none_value(
688688
_ = _create_table(
689689
session_catalog, identifier, {"format-version": format_version, **property_with_none}, [arrow_table_with_null]
690690
)
691-
assert "None type is not a supported value in properties" in str(exc_info.value)
691+
assert "None type is not a supported value in properties: property_name" in str(exc_info.value)

tests/table/test_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,4 +1107,4 @@ def test_table_properties_raise_for_none_value(example_table_metadata_v2: Dict[s
11071107
example_table_metadata_v2 = {**example_table_metadata_v2, "properties": property_with_none}
11081108
with pytest.raises(ValidationError) as exc_info:
11091109
TableMetadataV2(**example_table_metadata_v2)
1110-
assert "None type is not a supported value in properties" in str(exc_info.value)
1110+
assert "None type is not a supported value in properties: property_name" in str(exc_info.value)

0 commit comments

Comments
 (0)