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

# Snowflake

> Connect Mora to a Snowflake data warehouse.

## Prerequisites

* A Snowflake account.
* A user with at least read access to the target database, schema, and warehouse.

## Required fields

| Field | Description | Example |
| - | - | - |
| **Name** | A display name for this datasource. | `Mora warehouse` |
| **Account** | Your Snowflake account identifier. | `xy12345.us-east-1` |
| **Username** | The Snowflake user. | `admin` |
| **Authentication** | Either **Password** or **Key pair**. See [Authentication](#authentication). | `Password` |
| **Warehouse** | The compute warehouse to use for queries. | `COMPUTE_WH` |
| **Database** | The database to connect to. | `MY_DATABASE` |
| **Schema** | The default schema. | `PUBLIC` |

## Optional fields

| Field | Description | Example |
| - | - | - |
| **Role** | The Snowflake role to assume for the session. If omitted, the user's default role is used. | `ACCOUNTADMIN` |

## Authentication

### Password

Enter the Snowflake user's password. This is the default and requires no extra setup.

<Note>
  Snowflake is [phasing out single-factor password sign-in for service users](https://docs.snowflake.com/en/user-guide/key-pair-auth). If your user is affected, use key-pair authentication instead.
</Note>

### Key pair

Key-pair authentication signs each connection with an RSA private key instead of sending a password.

1. Generate a key pair. Use the second command instead if you want the key encrypted with a passphrase.

   ```bash theme={null}
   openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
   openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -v2 des3 -out rsa_key.p8
   ```

2. Extract the public key.

   ```bash theme={null}
   openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
   ```

3. Register the public key on the Snowflake user, pasting the contents of `rsa_key.pub` without the `BEGIN`/`END` lines.

   ```sql theme={null}
   ALTER USER admin SET RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...';
   ```

4. In Mora, select **Key pair**, then paste the full contents of `rsa_key.p8` into **Private key** — including the `-----BEGIN PRIVATE KEY-----` and `-----END PRIVATE KEY-----` lines.

5. If the key is encrypted (its first line reads `-----BEGIN ENCRYPTED PRIVATE KEY-----`), enter the passphrase in **Key passphrase**.

<Note>
  The key must be in PKCS#8 PEM format. A key that starts with `-----BEGIN RSA PRIVATE KEY-----` is PKCS#1 — convert it with `openssl pkcs8 -topk8 -inform PEM -in rsa_key.pem -out rsa_key.p8 -nocrypt`.
</Note>

## Steps

1. Open **Settings → Datasources → New**.
2. Enter a name and select **Snowflake** as the type.
3. Fill in the fields above.
4. Click **Test connection** to verify.
5. Click **Create**.

## Finding your account identifier

Your account identifier is in the URL you use to access Snowflake. For example, if you log in at `https://xy12345.us-east-1.snowflakecomputing.com`, your account identifier is `xy12345.us-east-1`.

## Related

* [Catalog sync](/datasources/catalog)
* [Managing datasources](/datasources/manage)


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