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

# Snowflake

> Connect Snowflake with key-pair authentication so OPTIMAZE can import credit usage and costs.

Connect Snowflake to OPTIMAZE with key-pair authentication and read-only views. OPTIMAZE generates the key pair and a setup script for you, then imports credit usage and costs, with warehouse compute cost spread across the queries that used it.

> [!NOTE]
>
> Snowflake is in beta. The tile on the **Integrations** page is marked **Beta**.

## Prerequisites

* A Snowflake user with an administrator role, to run the setup script.
* Your Snowflake account URL.

## Set up the Snowflake integration

**1. Open the Snowflake form**

Under **Data**, select **Integrations**. On the **Snowflake** tile, select **Connect**.

**2. Enter the connection details**

On **Connection details**, fill in the fields below, then select **Continue**.

| Field | What to enter |
| :- | :- |
| **Server URL** | Your account URL, without `https://` |
| **Database** | The database the setup script creates views in |
| **Schema** | The schema for those views |
| **Username** | The Snowflake user OPTIMAZE signs in as |
| **Warehouse (optional)** | The warehouse OPTIMAZE runs queries on |
| **Role (optional)** | The role OPTIMAZE uses |
| **Credit price (optional)** | The price of one Snowflake credit, used if OPTIMAZE cannot read it from your account |

**3. Run the setup script in Snowflake**

On **Set up Snowflake**, OPTIMAZE shows a **Setup SQL** script and a **Public key** it generated for you.
Copy the **Setup SQL** and run it in Snowflake as an administrator. It creates the read-only views and registers the public key for the user.
OPTIMAZE keeps the private key and never shows it.

**4. Connect and test**

Select **Connect and test**.

## What happens next

When you select **Connect**, OPTIMAZE runs a connection check before it starts importing. Each part of the check shows as passed, failed or not checked, and a later part is not checked when an earlier one fails.

| Check | What it confirms |
| :- | :- |
| **Authentication** | The credentials were accepted |
| **Access** | The credentials can read billing and usage data |
| **Required objects** | Anything you had to create in your own account exists. Not checked for providers that need nothing beyond credentials |
| **Data available** | There is cost data to import |

Once the check passes, the integration appears under **Connected** on the **Integrations** page. OPTIMAZE imports the previous six months of history on the first sync, and each later sync re-reads the last three days to pick up late changes.

If OPTIMAZE cannot read your credit price, compute costs arrive without a dollar value and the integration shows **Credit price missing**. Grant the role access to the organisation usage views, or reconnect with a **Credit price**.

## Troubleshooting

* **Authentication** fails: the setup script was not run, or was run for a different user. Run it again as an administrator.
* **Required objects** fails: the views the script creates are missing. Check the **Database** and **Schema** match the script, then run it again.
* **Credit price missing**: grant the role access to the organisation usage views, or reconnect with a **Credit price**.
* **Data available** fails: Snowflake has no cost data for the period yet. Wait for Snowflake to report usage, then connect again.


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