Skip to content

feat: Add REST loadCredentials support - #3499

Merged
kevinjqliu merged 2 commits into
mainfrom
codex/load-credentials-api
Jun 20, 2026
Merged

feat: Add REST loadCredentials support#3499
kevinjqliu merged 2 commits into
mainfrom
codex/load-credentials-api

Conversation

@kevinjqliu

@kevinjqliukevinjqliu commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add REST loadCredentials endpoint support
  • parse LoadCredentialsResponse
  • expose RestCatalog.load_credentials(...) with longest-prefix resolution for a target location

Contributes to #3495.

Notes

The pinned apache/iceberg-rest-fixture:1.10.1 used by integration tests does not serve the /credentials route, so this is covered with REST catalog unit tests rather than fixture-backed integration tests.

Testing

  • PYTHONPATH=. pytest tests/catalog/test_rest.py -k 'load_credentials or 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

@kevinjqliu
kevinjqliuforce-pushed the codex/load-credentials-api branch from 9cb70c8 to 69a6e5bCompareJune 13, 2026 21:07
@kevinjqliu
kevinjqliuforce-pushed the codex/load-credentials-api branch from 69a6e5b to 64d39b6CompareJune 13, 2026 21:11
@kevinjqliukevinjqliu changed the title [codex] Add REST loadCredentials supportfeat: Add REST loadCredentials supportJun 13, 2026
@kevinjqliu
kevinjqliu marked this pull request as ready for review June 13, 2026 21:22
Comment threadpyiceberg/catalog/rest/__init__.py Outdated

return ScanTasks.model_validate_json(response.text)

@retry(**_RETRY_ARGS)

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: These methods are added between _fetch_scan_tasks and plan_scan. These two methods are closely related. How about relocating these new methods to different locations?

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.

Yeah I mean they could be moved closer to the tables methods so it's easier to find. But just a nit lmk wyt @kevinjqliu

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

good eye! made the change, ty both!

Comment threadpyiceberg/catalog/rest/__init__.py Outdated
Comment on lines +561 to +562
response = self._session.get(
self.url(Endpoints.load_credentials, prefixed=True, **self._split_identifier_for_path(identifier)),

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.

Assuming we'll support optional parameters as a follow-up if necessary:

parameters:
- name: planIdin: queryrequired: falseschema:
type: stringdescription: The plan ID that has been used for server-side scan planning
- $ref: '#/components/parameters/referenced-by'

https://github.com/apache/iceberg/blob/51ee2cc0d993fe58de21b76613f350da97e9d3ef/open-api/rest-catalog-open-api.yaml#L1363-L1370

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

yep i purposely left it out to keep the PR smaller

@gabeiglio

Copy link
Copy Markdown
Contributor

This endpoint is somewhat ambiguous overall. It appears in the REST spec but is not implemented in the REST catalog (at least in Java). In practice, credential loading is handled directly by VendedCredentialsProvider.java, where IRC passes the URI and endpoint for requesting new credentials through the config.

This PR will also determine how the work I’m doing will invoke the credentials endpoint to obtain new credentials.

@rambleraptorrambleraptor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd love to see planId as a fast-follow, but this looks good as-is.

@geruhgeruh left a comment

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.

LGTM just one minor nit.

Comment threadpyiceberg/catalog/rest/__init__.py Outdated

return ScanTasks.model_validate_json(response.text)

@retry(**_RETRY_ARGS)

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.

Yeah I mean they could be moved closer to the tables methods so it's easier to find. But just a nit lmk wyt @kevinjqliu

@kevinjqliu

Copy link
Copy Markdown
ContributorAuthor

This PR will also determine how the work I’m doing will invoke the credentials endpoint to obtain new credentials.

yep! this PR + #3500 wires up the component to use the /credentials endpoint when available

@kevinjqliu
kevinjqliu merged commit a38bbe3 into mainJun 20, 2026
@kevinjqliu
kevinjqliu deleted the codex/load-credentials-api branch June 20, 2026 23:11
@kevinjqliu

Copy link
Copy Markdown
ContributorAuthor

thanks for the review everyone!

Sign up for freeto 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.

5 participants

@kevinjqliu@gabeiglio@rambleraptor@ebyhr@geruh