diff --git a/pyiceberg/table/__init__.py b/pyiceberg/table/__init__.py index 07bf2587a0..bb3b7afe33 100644 --- a/pyiceberg/table/__init__.py +++ b/pyiceberg/table/__init__.py @@ -474,8 +474,10 @@ class SetLocationUpdate(TableUpdate): class SetPropertiesUpdate(TableUpdate): action: TableUpdateAction = TableUpdateAction.set_properties updates: Properties - # validators - transform_properties_dict_value_to_str = field_validator('updates', mode='before')(transform_dict_value_to_str) + + @field_validator('updates', mode='before') + def transform_properties_dict_value_to_str(cls, properties: Properties) -> Dict[str, str]: + return transform_dict_value_to_str(properties) class RemovePropertiesUpdate(TableUpdate): diff --git a/tests/integration/test_reads.py b/tests/integration/test_reads.py index c01f8f32d6..fdc13ae752 100644 --- a/tests/integration/test_reads.py +++ b/tests/integration/test_reads.py @@ -169,38 +169,6 @@ def test_table_properties_error(catalog: Catalog) -> None: assert "Cannot pass both properties and kwargs" in str(e.value) -@pytest.mark.integration -@pytest.mark.parametrize('catalog', [pytest.lazy_fixture('catalog_hive'), pytest.lazy_fixture('catalog_rest')]) -def test_table_properties_dict(catalog: Catalog) -> None: - table = create_table(catalog) - - assert table.properties == DEFAULT_PROPERTIES - - with table.transaction() as transaction: - transaction.set_properties({"abc": "🤪"}) - assert table.properties == dict({"abc": "🤪"}, **DEFAULT_PROPERTIES) - - with table.transaction() as transaction: - transaction.remove_properties("abc") - assert table.properties == DEFAULT_PROPERTIES - - table = table.transaction().set_properties({"abc": "def"}).commit_transaction() - assert table.properties == dict({"abc": "def"}, **DEFAULT_PROPERTIES) - - table = table.transaction().remove_properties("abc").commit_transaction() - assert table.properties == DEFAULT_PROPERTIES - - -@pytest.mark.integration -@pytest.mark.parametrize('catalog', [pytest.lazy_fixture('catalog_hive'), pytest.lazy_fixture('catalog_rest')]) -def test_table_properties_error(catalog: Catalog) -> None: - table = create_table(catalog) - properties = {"abc": "def"} - with pytest.raises(ValueError) as e: - table.transaction().set_properties(properties, abc="def").commit_transaction() - assert "Cannot pass both properties and kwargs" in str(e.value) - - @pytest.mark.integration @pytest.mark.parametrize('catalog', [pytest.lazy_fixture('catalog_hive'), pytest.lazy_fixture('catalog_rest')]) def test_pyarrow_nan(catalog: Catalog) -> None: