Skip to content

Commit d52cef7

Browse files
committed
fix PR issues
1 parent ecb82b8 commit d52cef7

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
@@ -560,9 +560,6 @@ def construct_refs(cls, table_metadata: TableMetadata) -> TableMetadata:
560560
next_row_id: Optional[int] = Field(alias="next-row-id", default=None)
561561
"""A long higher than all assigned row IDs; the next snapshot's `first-row-id`."""
562562

563-
row_lineage: Optional[bool] = Field(alias="row-lineage", default=False)
564-
"""Setting whether or not to track the creation and updates to rows in the table."""
565-
566563
def model_dump_json(
567564
self, exclude_none: bool = True, exclude: Optional[Any] = None, by_alias: bool = True, **kwargs: Any
568565
) -> str:

pyiceberg/table/snapshots.py

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

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

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

267269
class MetadataLogEntry(IcebergBaseModel):
268270
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
@@ -296,12 +296,10 @@ def _commit(self) -> UpdatesAndRequirements:
296296
) as writer:
297297
writer.add_manifests(new_manifests)
298298

299-
added_rows: Optional[int] = None
300299
first_row_id: Optional[int] = None
301300

302301
if self._transaction.table_metadata.format_version >= 3:
303302
first_row_id = self._transaction.table_metadata.next_row_id
304-
added_rows = self._calculate_added_rows(new_manifests)
305303

306304
snapshot = Snapshot(
307305
snapshot_id=self._snapshot_id,
@@ -310,7 +308,6 @@ def _commit(self) -> UpdatesAndRequirements:
310308
sequence_number=next_sequence_number,
311309
summary=summary,
312310
schema_id=self._transaction.table_metadata.current_schema_id,
313-
added_rows=added_rows,
314311
first_row_id=first_row_id,
315312
)
316313

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)