rdblue commented on code in PR #6323:
URL: https://github.com/apache/iceberg/pull/6323#discussion_r1199810584


##########
python/pyiceberg/catalog/rest.py:
##########
@@ -490,6 +498,27 @@ def rename_table(self, from_identifier: Union[str, 
Identifier], to_identifier: U
 
         return self.load_table(to_identifier)
 
+    def alter_table(self, identifier: Union[str, Identifier], updates: 
Tuple[BaseTableUpdate, ...]) -> TableResponse:
+        """Updates the table
+
+        Args:
+            identifier (str | Identifier): Namespace identifier
+            updates (Tuple[BaseTableUpdate]): Updates to be applied to the 
table
+        Raises:
+            NoSuchTableError: If a table with the given identifier does not 
exist
+        """
+        print(updates)
+        payload = CommitTableRequest(updates=updates).json()
+        response = self._session.post(
+            self.url(Endpoints.update_table, prefixed=True, 
**self._split_identifier_for_path(identifier)),
+            data=payload,
+        )
+        try:
+            response.raise_for_status()
+        except HTTPError as exc:
+            self._handle_non_200_response(exc, {})

Review Comment:
   Commit error handling needs [some different 
logic](https://github.com/apache/iceberg/blob/master/core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java#L71-L90).
   * 409 should throw `CommitFailedException` so that the caller can refresh 
metadata and retry
   * 500, 502, and 504 should throw `CommitStateUnknownException` because it 
isn't clear whether the attempt succeeded or failed.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to