kevinjqliu commented on code in PR #1246:
URL: https://github.com/apache/iceberg-python/pull/1246#discussion_r1818185830


##########
pyiceberg/table/__init__.py:
##########
@@ -231,9 +233,13 @@ def __enter__(self) -> Transaction:
         """Start a transaction to update the table."""
         return self
 
-    def __exit__(self, _: Any, value: Any, traceback: Any) -> None:
-        """Close and commit the transaction."""
-        self.commit_transaction()
+    def __exit__(
+        self, exctype: Optional[Type[BaseException]], excinst: 
Optional[BaseException], exctb: Optional[TracebackType]
+    ) -> None:
+        """Close and commit the transaction, or handle exceptions."""
+        # Only commit the full transaction, if there is no exception in all 
updates on the chain

Review Comment:
   > Exit the runtime context related to this object. The parameters describe 
the exception that caused the context to be exited. If the context was exited 
without an exception, all three arguments will be None.
   
   From https://docs.python.org/3/reference/datamodel.html#object.__exit__



-- 
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