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

# Snowflake Horizon

> Register Snowflake Horizon as an Iceberg catalog.

[Snowflake Horizon](https://docs.snowflake.com/en/user-guide/tables-iceberg-query-using-external-query-engine-snowflake-horizon) is Snowflake's built-in Iceberg REST catalog. Registering it makes your Snowflake-managed Iceberg tables queryable from the lake. Credentials for the table files are vended by Snowflake, so you don't configure any storage access.

> [!NOTE]
>
> To query regular Snowflake tables, use a [Snowflake connection](https://docs.oleander.dev/connections/snowflake.md) instead.

## Setup

### 1. Create a key pair

Authenticate as a Snowflake user with an encrypted RSA key pair:

```bash theme={null}
openssl genrsa 2048 | openssl pkcs8 -topk8 -v2 aes-256-cbc -inform PEM -out rsa_key.p8
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
```

```sql theme={null}
ALTER USER my_user SET RSA_PUBLIC_KEY='<contents of rsa_key.pub>';
```

### 2. Register the catalog

1. Open [Settings → Lake](https://oleander.dev/app/settings/lake) and find **External catalogs**.
2. Select **Snowflake Horizon** and fill in the fields:

| Field | Description |
| - | - |
| **Catalog name** | A short name, e.g. `sf_horizon`. Tables are queried as `name.schema.table`. |
| **Catalog URI** | `https://<account>.snowflakecomputing.com/polaris/api/catalog` |
| **Catalog database** | The Snowflake database to expose |
| **Role** | The Snowflake role used to read the catalog |
| **Cloud provider** | Where your Snowflake account runs |
| **Region** | Your Snowflake account's region, e.g. `us-west-2` |
| **Username** | The Snowflake user from step 1 |
| **Private key (PEM)** | The contents of `rsa_key.p8` |
| **Private key passphrase** | The key's passphrase |

Or from the [CLI](https://docs.oleander.dev/cli/lake.md#register-a-catalog), piping the passphrase on stdin:

```bash theme={null}
printenv SNOWFLAKE_KEY_PASSPHRASE | oleander catalogs register sf_horizon \
  --type horizon \
  --catalog-uri https://<account>.snowflakecomputing.com/polaris/api/catalog \
  --database ANALYTICS \
  --role OLEANDER_ROLE \
  --region us-west-2 \
  --username OLEANDER \
  --private-key-file ./rsa_key.p8
```

The CLI also accepts a programmatic access token with `--auth-type pat`, piped on stdin.

## Query

Test the catalog from the CLI:

```bash theme={null}
oleander query '
  SELECT
    species,
    COUNT(*) AS n
  FROM sf_horizon.default.flowers
  GROUP BY species
  ORDER BY n DESC
' --engine duckdb
```

Drop `--engine duckdb` to let oleander pick the engine automatically.


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