diff --git a/pyiceberg/table/__init__.py b/pyiceberg/table/__init__.py index 5c82daa525..c1e0f61137 100644 --- a/pyiceberg/table/__init__.py +++ b/pyiceberg/table/__init__.py @@ -957,7 +957,7 @@ def _initial_changes(self, table_metadata: TableMetadata) -> None: schema: Schema = table_metadata.schema() self._updates += ( - AddSchemaUpdate(schema_=schema, last_column_id=schema.highest_field_id), + AddSchemaUpdate(schema_=schema), SetCurrentSchemaUpdate(schema_id=-1), ) diff --git a/pyiceberg/table/update/__init__.py b/pyiceberg/table/update/__init__.py index 3f7d43f0ef..6619c486f2 100644 --- a/pyiceberg/table/update/__init__.py +++ b/pyiceberg/table/update/__init__.py @@ -49,7 +49,6 @@ transform_dict_value_to_str, ) from pyiceberg.utils.datetime import datetime_to_millis -from pyiceberg.utils.deprecated import deprecation_notice from pyiceberg.utils.properties import property_as_int if TYPE_CHECKING: @@ -92,16 +91,6 @@ class UpgradeFormatVersionUpdate(IcebergBaseModel): class AddSchemaUpdate(IcebergBaseModel): action: Literal["add-schema"] = Field(default="add-schema") schema_: Schema = Field(alias="schema") - # This field is required: https://github.com/apache/iceberg/pull/7445 - last_column_id: Optional[int] = Field( - alias="last-column-id", - default=None, - deprecated=deprecation_notice( - deprecated_in="0.9.0", - removed_in="0.10.0", - help_message="last-field-id is handled internally, and should not be part of the update.", - ), - ) class SetCurrentSchemaUpdate(IcebergBaseModel): diff --git a/pyiceberg/table/update/schema.py b/pyiceberg/table/update/schema.py index 6ad01e97f2..ec8e7f087e 100644 --- a/pyiceberg/table/update/schema.py +++ b/pyiceberg/table/update/schema.py @@ -629,9 +629,8 @@ def _commit(self) -> UpdatesAndRequirements: if existing_schema_id != self._schema.schema_id: requirements += (AssertCurrentSchemaId(current_schema_id=self._schema.schema_id),) if existing_schema_id is None: - last_column_id = max(self._transaction.table_metadata.last_column_id, new_schema.highest_field_id) updates += ( - AddSchemaUpdate(schema=new_schema, last_column_id=last_column_id), + AddSchemaUpdate(schema=new_schema), SetCurrentSchemaUpdate(schema_id=-1), ) else: diff --git a/tests/catalog/test_base.py b/tests/catalog/test_base.py index 2ab97b4285..01fea25dfa 100644 --- a/tests/catalog/test_base.py +++ b/tests/catalog/test_base.py @@ -486,7 +486,7 @@ def test_commit_table(catalog: InMemoryCatalog) -> None: response = given_table.catalog.commit_table( given_table, updates=( - AddSchemaUpdate(schema=new_schema, last_column_id=new_schema.highest_field_id), + AddSchemaUpdate(schema=new_schema), SetCurrentSchemaUpdate(schema_id=-1), ), requirements=(), diff --git a/tests/catalog/test_rest.py b/tests/catalog/test_rest.py index c78a0344f1..b21b8fc34d 100644 --- a/tests/catalog/test_rest.py +++ b/tests/catalog/test_rest.py @@ -1122,7 +1122,6 @@ def test_create_staged_table_200( "schema-id": 0, "identifier-field-ids": [], }, - "last-column-id": 2, }, {"action": "set-current-schema", "schema-id": -1}, {"action": "add-spec", "spec": {"spec-id": 0, "fields": []}},