You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not obvious how to connect PyIceberg to a Polaris catalog.
This PR clears that up by providing an example in the getting-started section of the documentation.
Copy file name to clipboardExpand all lines: site/content/in-dev/unreleased/getting-started/using-polaris.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -285,6 +285,51 @@ SELECT * FROM iceberg.quickstart_schema.quickstart_table;
285
285
org.apache.iceberg.exceptions.ForbiddenException: Forbidden: Principal 'quickstart_user' with activated PrincipalRoles '[]'and activated grants via '[quickstart_catalog_role, quickstart_user_role]' is not authorized for op LOAD_TABLE_WITH_READ_DELEGATION
286
286
```
287
287
288
+
### Connecting with PyIceberg
289
+
290
+
#### Using Credentials
291
+
292
+
```python
293
+
from pyiceberg.catalog import load_catalog
294
+
295
+
catalog = load_catalog(
296
+
type='rest',
297
+
uri='http://localhost:8181/api/catalog',
298
+
warehouse='quickstart_catalog',
299
+
scope="PRINCIPAL_ROLE:ALL",
300
+
credential=f"{CLIENT_ID}:{CLIENT_SECRET}",
301
+
)
302
+
```
303
+
304
+
If the `load_catalog` function is used with credentials, then PyIceberg will automatically request an authorization token from the `v1/oauth/tokens` endpoint, and will later use this token to prove its identity to the Polaris Catalog.
It is possible to use `load_catalog` function by providing an authorization token directly. This method is useful when using an external identity provider (e.g. Google Identity).
332
+
288
333
### Connecting Using REST APIs
289
334
290
335
To access Polaris from the host machine, first request an access token:
0 commit comments