Skip to content

Commit 3d26012

Browse files
committed
1 parent 73ec7d9 commit 3d26012

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

pyiceberg/catalog/rest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ def _response_to_table(self, identifier_tuple: Tuple[str, ...], table_response:
525525
{**table_response.metadata.properties, **table_response.config}, table_response.metadata_location
526526
),
527527
catalog=self,
528+
config=table_response.config,
528529
)
529530

530531
def _response_to_staged_table(self, identifier_tuple: Tuple[str, ...], table_response: TableResponse) -> StagedTable:
@@ -777,9 +778,15 @@ def commit_table(
777778
identifier = self._identifier_to_tuple_without_catalog(table.identifier)
778779
table_identifier = TableIdentifier(namespace=identifier[:-1], name=identifier[-1])
779780
table_request = CommitTableRequest(identifier=table_identifier, requirements=requirements, updates=updates)
781+
782+
headers = self._session.headers
783+
if table_token := table.config["token"]:
784+
headers[AUTHORIZATION_HEADER] = f"{BEARER_PREFIX} {table_token}"
785+
780786
response = self._session.post(
781787
self.url(Endpoints.update_table, prefixed=True, **self._split_identifier_for_path(table_request.identifier)),
782788
data=table_request.model_dump_json().encode(UTF8),
789+
headers=headers,
783790
)
784791
try:
785792
response.raise_for_status()

pyiceberg/table/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,15 +784,23 @@ class Table:
784784
metadata_location: str = Field()
785785
io: FileIO
786786
catalog: Catalog
787+
config: Dict[str, str]
787788

788789
def __init__(
789-
self, identifier: Identifier, metadata: TableMetadata, metadata_location: str, io: FileIO, catalog: Catalog
790+
self,
791+
identifier: Identifier,
792+
metadata: TableMetadata,
793+
metadata_location: str,
794+
io: FileIO,
795+
catalog: Catalog,
796+
config: Dict[str, str] = EMPTY_DICT,
790797
) -> None:
791798
self._identifier = identifier
792799
self.metadata = metadata
793800
self.metadata_location = metadata_location
794801
self.io = io
795802
self.catalog = catalog
803+
self.config = config
796804

797805
def transaction(self) -> Transaction:
798806
"""Create a new transaction object to first stage the changes, and then commit them to the catalog.

0 commit comments

Comments
 (0)