Skip to content

Load table credentials from credentials endpoint#3500

Closed
kevinjqliu wants to merge 1 commit into
mainfrom
codex/load-credentials-table-integration
Closed

Load table credentials from credentials endpoint#3500
kevinjqliu wants to merge 1 commit into
mainfrom
codex/load-credentials-table-integration

Conversation

@kevinjqliu

@kevinjqliu kevinjqliu commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Load table credentials from /credentials during REST table response handling when inline credentials are absent.
  • Only call the endpoint when the catalog advertises loadCredentials and vended-credentials access delegation is requested.
  • Resolve loaded storage credentials by longest prefix against the table location, while keeping inline storage-credentials precedence over catalog config.
  • Avoid the extra /credentials request for remote signing and catalogs that do not advertise the endpoint.

Stacked on #3499.

Testing

  • PYTHONPATH=. pytest tests/catalog/test_rest.py -k 'load_credentials or storage_credentials or load_table_honor_access_delegation or load_table_without_storage_credentials'
  • ruff check pyiceberg/catalog/rest/__init__.py tests/catalog/test_rest.py
  • ruff format --check pyiceberg/catalog/rest/__init__.py tests/catalog/test_rest.py
  • pre-commit hooks during git commit

@kevinjqliu kevinjqliu force-pushed the codex/load-credentials-table-integration branch 15 times, most recently from eddce8f to 0f80215 Compare June 13, 2026 22:17
if Capability.V1_LOAD_CREDENTIALS not in self._supported_endpoints:
return False

access_delegation = cast(str, self._session.headers.get(ACCESS_DELEGATION_HEADER, ""))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we need to cast or does it break linter? locally it shows unnecessary cast; type is already 'str'

# Load credentials only when vended-credentials is requested.
return any(delegation.strip().lower() == ACCESS_DELEGATION_DEFAULT for delegation in access_delegation.split(","))

def _resolve_table_credentials_from_response_or_endpoint(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compared this to Java RESTSessionCatalog and VendedCredentialsProvider. They don't call the /credentials api during loadTable and instead seems to rely on inline storage-credentials on load_table call, and uses the credential endpoint for refresh in FileIO.

We don't have that layer, today so this eager fallback makes sense to me. And just putting this here so it's clear.

config=table_response.config,
)

def _response_to_staged_table(self, identifier_tuple: tuple[str, ...], table_response: TableResponse) -> StagedTable:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we are still inlining here still and not using _resolve_table_credentials_from_response_or_endpoint, or are you handling that as a followup?

Base automatically changed from codex/load-credentials-api to main June 20, 2026 23:11
@kevinjqliu kevinjqliu force-pushed the codex/load-credentials-table-integration branch from 0f80215 to 321413a Compare June 20, 2026 23:16
@kevinjqliu

Copy link
Copy Markdown
Contributor Author

Compared this to Java RESTSessionCatalog and VendedCredentialsProvider. They don't call the /credentials api during loadTable and instead seems to rely on inline storage-credentials on load_table call, and uses the credential endpoint for refresh in FileIO.

yea i realized that. I thought the fallback is cheeky, but it diverges from the java implementation. I dont want to create subtle behavioral difference.
loadTable should expect credentials from the inline storage-credentials in response and /credentials should be used by refresh directly.

this also aligns with what @gabeiglio mentioned here: #3499 (comment)

I'm going to close this PR in favor of #3507, which should properly use the /crendentials endpoint for FileIO refresh

@kevinjqliu kevinjqliu closed this Jun 20, 2026
@kevinjqliu kevinjqliu deleted the codex/load-credentials-table-integration branch June 20, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants