From 7cac44dc7239a82e0e236c885633b98776222e72 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Wed, 11 Oct 2023 11:25:58 +0200 Subject: [PATCH 1/2] Add method and property around sequence-numbers --- pyiceberg/table/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyiceberg/table/__init__.py b/pyiceberg/table/__init__.py index c171b39c26..0f7343029f 100644 --- a/pyiceberg/table/__init__.py +++ b/pyiceberg/table/__init__.py @@ -529,6 +529,13 @@ def location(self) -> str: """Return the table's base location.""" return self.metadata.location + @property + def last_sequence_number(self) -> int: + return self.metadata.last_sequence_number + + def next_sequence_number(self) -> int: + return INITIAL_SEQUENCE_NUMBER if self.format_version == 1 else self.last_sequence_number + 1 + def new_snapshot_id(self) -> int: """Generate a new snapshot-id that's not in use.""" snapshot_id = _generate_snapshot_id() From 2e03898389cabbe6a74775c1e6977f3bfb347c4b Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Wed, 11 Oct 2023 13:53:56 +0200 Subject: [PATCH 2/2] Remove whitespace --- pyiceberg/table/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyiceberg/table/__init__.py b/pyiceberg/table/__init__.py index 0f7343029f..fe89915998 100644 --- a/pyiceberg/table/__init__.py +++ b/pyiceberg/table/__init__.py @@ -535,7 +535,7 @@ def last_sequence_number(self) -> int: def next_sequence_number(self) -> int: return INITIAL_SEQUENCE_NUMBER if self.format_version == 1 else self.last_sequence_number + 1 - + def new_snapshot_id(self) -> int: """Generate a new snapshot-id that's not in use.""" snapshot_id = _generate_snapshot_id()