Fokko commented on code in PR #247:
URL: https://github.com/apache/iceberg-python/pull/247#discussion_r1440199047


##########
pyiceberg/table/__init__.py:
##########
@@ -942,15 +942,16 @@ def snapshot(self) -> Optional[Snapshot]:
         return self.table.current_snapshot()
 
     def projection(self) -> Schema:
-        snapshot_schema = self.table.schema()
-        if snapshot := self.snapshot():
-            if snapshot.schema_id is not None:
-                snapshot_schema = self.table.schemas()[snapshot.schema_id]
+        current_schema = self.table.schema()
+        if self.snapshot_id is not None:
+            snapshot = self.table.snapshot_by_id(self.snapshot_id)

Review Comment:
   Great catch @amogh-jahagirdar I'm not super strong on this one. Typically, I 
would not fail in these situations, but I agree that [raising a 
warning](https://docs.python.org/3/library/warnings.html#module-warnings) might 
be appropriate here.
   
   I know there are thoughts of pruning old schemas, which might lead to this 
situation, but I would expect this to happen regularly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to