This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
The following commit(s) were added to refs/heads/main by this push:
new 452238e Bug fix falsy value of zero (#249)
452238e is described below
commit 452238e33f2be86b9076be78db2441aea043afb8
Author: Mehul Batra <[email protected]>
AuthorDate: Thu Jan 4 13:48:15 2024 +0530
Bug fix falsy value of zero (#249)
* certain values are considered False in a boolean context. These include
None,0, empty sequences/collections, we are explicity handling that as in our
case 0 stands for true
* Update pyiceberg/table/__init__.py
Co-authored-by: Fokko Driesprong <[email protected]>
---------
Co-authored-by: Fokko Driesprong <[email protected]>
---
pyiceberg/table/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyiceberg/table/__init__.py b/pyiceberg/table/__init__.py
index 40b37cc..fa04fb7 100644
--- a/pyiceberg/table/__init__.py
+++ b/pyiceberg/table/__init__.py
@@ -809,8 +809,8 @@ class Table:
def current_snapshot(self) -> Optional[Snapshot]:
"""Get the current snapshot for this table, or None if there is no
current snapshot."""
- if snapshot_id := self.metadata.current_snapshot_id:
- return self.snapshot_by_id(snapshot_id)
+ if self.metadata.current_snapshot_id is not None:
+ return self.snapshot_by_id(self.metadata.current_snapshot_id)
return None
def snapshot_by_id(self, snapshot_id: int) -> Optional[Snapshot]: