Skip to content

Commit d052b55

Browse files
committed
fix PR issues
1 parent ecf2f70 commit d052b55

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

pyiceberg/table/metadata.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,6 @@ def construct_refs(cls, table_metadata: TableMetadata) -> TableMetadata:
552552
next_row_id: Optional[int] = Field(alias="next-row-id", default=None)
553553
"""A long higher than all assigned row IDs; the next snapshot's `first-row-id`."""
554554

555-
row_lineage: Optional[bool] = Field(alias="row-lineage", default=False)
556-
"""Setting whether or not to track the creation and updates to rows in the table."""
557-
558555
def model_dump_json(
559556
self, exclude_none: bool = True, exclude: Optional[Any] = None, by_alias: bool = True, **kwargs: Any
560557
) -> str:

pyiceberg/table/snapshots.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ class Snapshot(IcebergBaseModel):
246246
first_row_id: Optional[int] = Field(
247247
alias="first-row-id", default=None, description="assigned to the first row in the first data file in the first manifest"
248248
)
249-
added_rows: Optional[int] = Field(
250-
alias="added-rows", default=None, description="Sum of the `added_rows_count` from all manifests added in this snapshot."
251-
)
249+
_added_rows: Optional[int] = PrivateAttr()
252250

253251
def __str__(self) -> str:
254252
"""Return the string representation of the Snapshot class."""
@@ -262,6 +260,10 @@ def manifests(self, io: FileIO) -> List[ManifestFile]:
262260
"""Return the manifests for the given snapshot."""
263261
return list(_manifests(io, self.manifest_list))
264262

263+
@property
264+
def added_rows(self) -> Optional[int]:
265+
return self._added_rows
266+
265267

266268
class MetadataLogEntry(IcebergBaseModel):
267269
metadata_file: str = Field(alias="metadata-file")

pyiceberg/table/update/snapshot.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,10 @@ def _commit(self) -> UpdatesAndRequirements:
282282
) as writer:
283283
writer.add_manifests(new_manifests)
284284

285-
added_rows: Optional[int] = None
286285
first_row_id: Optional[int] = None
287286

288287
if self._transaction.table_metadata.format_version >= 3:
289288
first_row_id = self._transaction.table_metadata.next_row_id
290-
added_rows = self._calculate_added_rows(new_manifests)
291289

292290
snapshot = Snapshot(
293291
snapshot_id=self._snapshot_id,
@@ -296,7 +294,6 @@ def _commit(self) -> UpdatesAndRequirements:
296294
sequence_number=next_sequence_number,
297295
summary=summary,
298296
schema_id=self._transaction.table_metadata.current_schema_id,
299-
added_rows=added_rows,
300297
first_row_id=first_row_id,
301298
)
302299

tests/table/test_snapshots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ def test_deserialize_snapshot_with_properties(snapshot_with_properties: Snapshot
139139
def test_snapshot_repr(snapshot: Snapshot) -> None:
140140
assert (
141141
repr(snapshot)
142-
== """Snapshot(snapshot_id=25, parent_snapshot_id=19, sequence_number=200, timestamp_ms=1602638573590, manifest_list='s3:/a/b/c.avro', summary=Summary(Operation.APPEND), schema_id=3)"""
142+
== """Snapshot(snapshot_id=25, parent_snapshot_id=19, sequence_number=200, timestamp_ms=1602638573590, manifest_list='s3:/a/b/c.avro', summary=Summary(Operation.APPEND), schema_id=3, first_row_id=None)"""
143143
)
144144
assert snapshot == eval(repr(snapshot))
145145

146146

147147
def test_snapshot_with_properties_repr(snapshot_with_properties: Snapshot) -> None:
148148
assert (
149149
repr(snapshot_with_properties)
150-
== """Snapshot(snapshot_id=25, parent_snapshot_id=19, sequence_number=200, timestamp_ms=1602638573590, manifest_list='s3:/a/b/c.avro', summary=Summary(Operation.APPEND, **{'foo': 'bar'}), schema_id=3)"""
150+
== """Snapshot(snapshot_id=25, parent_snapshot_id=19, sequence_number=200, timestamp_ms=1602638573590, manifest_list='s3:/a/b/c.avro', summary=Summary(Operation.APPEND, **{'foo': 'bar'}), schema_id=3, first_row_id=None)"""
151151
)
152152
assert snapshot_with_properties == eval(repr(snapshot_with_properties))
153153

0 commit comments

Comments
 (0)