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


##########
pyiceberg/catalog/rest.py:
##########
@@ -777,9 +778,15 @@ def commit_table(
         identifier = 
self._identifier_to_tuple_without_catalog(table.identifier)
         table_identifier = TableIdentifier(namespace=identifier[:-1], 
name=identifier[-1])
         table_request = CommitTableRequest(identifier=table_identifier, 
requirements=requirements, updates=updates)
+
+        headers = self._session.headers
+        if table_token := table.config.get("token"):

Review Comment:
   wdyt about moving this logic to `_response_to_table` and use 
`self._refresh_token`
   
https://github.com/apache/iceberg-python/blob/e7de0cceed6e7f4e68c427150b3d3bfd3625536d/pyiceberg/catalog/rest.py#L280
   
   every time we get a `Table` object from the server response, 
`_refresh_token` will set the session's header
   
https://github.com/apache/iceberg-python/blob/e7de0cceed6e7f4e68c427150b3d3bfd3625536d/pyiceberg/catalog/rest.py#L549-L551
   
   and subsequent requests should use that automatically



##########
pyiceberg/catalog/rest.py:
##########
@@ -777,9 +778,15 @@ def commit_table(
         identifier = 
self._identifier_to_tuple_without_catalog(table.identifier)
         table_identifier = TableIdentifier(namespace=identifier[:-1], 
name=identifier[-1])
         table_request = CommitTableRequest(identifier=table_identifier, 
requirements=requirements, updates=updates)
+
+        headers = self._session.headers
+        if table_token := table.config.get("token"):

Review Comment:
   ```suggestion
           if table_token := table.config.get(TOKEN):
   ```
   nit, use `TOKEN`



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