> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to Unity Catalog Iceberg REST using OAuth client credentials

> Register Unity Catalog Iceberg REST in Unified and read an existing table with

How-to guideApplies to: Unified engine deployments

Register Unity Catalog Iceberg REST in Unified and read an existing table with
OAuth client credentials.

## Before you start

Use an existing catalog with at least one readable Iceberg table. The engine and
workers must reach the catalog and its table storage. Have the remote identity
and permissions ready before creating the Unified registration. Replace the
namespace and table with one you know has data.

Use the Iceberg REST endpoint supplied by your workspace administrator. It
differs from the native Unity Catalog API. The selected table must be exposed
through that REST interface.

The service must return usable temporary storage credentials, or the table
location must already have configured storage access in Unified. Requesting
delegation alone does not grant access. Local secret values require the
[encrypted secret store](https://docs.e6data.com/transformation/operations/configuration/secrets.md).

## Values to collect

* Catalog API URI, warehouse, namespace, and table.
* Client ID, client secret, and token endpoint. Confirm that the application can request the all-apis scope.

## Run the SQL

Replace every `<placeholder>` before running. Use unused names for the resources
below. Run the statements in order in Workbench.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE SECRET recipe_unity_rest_oauth_secret AS '<client-secret>';

CREATE CREDENTIAL recipe_unity_rest_oauth_auth USING oauth2
OPTIONS (
  'authentication' = 'client_credentials',
  'client_id' = '<client-id>',
  'token_endpoint' = '<token-endpoint>'
)
SECRETS ('client_secret' = 'recipe_unity_rest_oauth_secret');

CREATE CATALOG recipe_unity_rest_oauth USING `iceberg-rest`
OPTIONS (
  'uri' = '<catalog-api-uri>',
  'warehouse' = '<warehouse>',
  'catalog.type' = 'unity',
  'auth.type' = 'oauth2',
  'oauth2-server-uri' = '<token-endpoint>',
  'scope' = 'all-apis',
  'header.x-iceberg-access-delegation' = 'vended-credentials'
)
CREDENTIALS ('auth' = 'recipe_unity_rest_oauth_auth');

SELECT *
FROM recipe_unity_rest_oauth.`<namespace>`.`<table>`
LIMIT 5;
```

## Check the result

The SELECT should return up to five rows from the chosen table. Use a nonempty
table for this check. This verifies both metadata and table-file access;
creating the registration alone does not verify either.

## Clean up

This removes only the Unified registrations. It leaves the remote catalog and
its tables in place.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
DROP CATALOG recipe_unity_rest_oauth;
DROP CREDENTIAL recipe_unity_rest_oauth_auth;
DROP SECRET recipe_unity_rest_oauth_secret;
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.