iceberg-python icon indicating copy to clipboard operation
iceberg-python copied to clipboard

PyIceberg permits OAuth URI in REST config but Iceberg Java does not

Open smaheshwar-pltr opened this issue 11 months ago • 2 comments

When a RESTCatalog is constructed, _fetch_config immediately "merges" catalog properties with the REST server's response to get_config, updating self.properties accordingly.

https://github.com/apache/iceberg-python/blob/efc8b5ac0f16717f776e034ecf9a9e9bdabd8424/pyiceberg/catalog/rest.py#L265

RESTCatalog#auth_url, invoked after construction of the RESTCatalog, then uses those "merged" properties to get the auth_url:

https://github.com/apache/iceberg-python/blob/efc8b5ac0f16717f776e034ecf9a9e9bdabd8424/pyiceberg/catalog/rest.py#L330-L331

If I've understood correctly, this means PyIceberg users can get the auth URI from the server-returned configs instead of having to configure it themselves.

On the other hand, Iceberg's Java side sets oauth2ServerUri before the config is fetched here so it doesn't allow the above. To note that it uses the fetchToken response to fetch the config.

Actually not sure which behaviour is better/correct here - just flagging that they're different and feels weird that REST servers can provide this URI for PyIceberg but not on the Java-side.

smaheshwar-pltr avatar Feb 19 '25 15:02 smaheshwar-pltr

Yeah, this definitely seems like an inconsistency in behavior between Python and Java, as PyIceberg allows the server to override the user's OAuth2 URL before initialization, whereas Java enforces that the client explicitly sets it.

It's probably best to align with Java, given that they’ve been working on this for a while per this doc.

However, to your point yeah it is a bit weird I still think it’s a good question to raise for the Java side. While they are enforcing that the client must configure this property, it can be useful for the server to enforce the latest url with the config endpoint. Although this only works if the config endpoint is a discovery api meaning no auth just conf.

geruh avatar Feb 20 '25 00:02 geruh

Update: the Java codepath has changed on main with the AuthManager changes, and it looks like PyIceberg will follow suit (https://github.com/apache/iceberg-python/issues/1876) so this specific difference may soon go away!

smaheshwar-pltr avatar Apr 18 '25 05:04 smaheshwar-pltr

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Nov 28 '25 00:11 github-actions[bot]

This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'

github-actions[bot] avatar Dec 12 '25 00:12 github-actions[bot]