# Snowflake

> Run a LevelFour-generated script in Snowflake.

Source: https://docs.levelfour.ai/connectors/snowflake


## Prerequisites

* An organization account, or a regular account with ORGADMIN enabled. Only these can read the organization usage views this connector uses.
* ACCOUNTADMIN access, to run the setup script.
* Reseller-contracted Snowflake accounts cannot read the organization billing views, so this connector will not work for them.

## What it costs you

This connector runs one small scheduled query a day, on a dedicated XS warehouse with auto-suspend after 60 seconds. Expect about half a credit a month on your Snowflake bill, or $1 to $2 at US on-demand list prices.

## Connect

### Get your setup script

Open **Connect Providers**, select **Snowflake**, and enter your account identifier (for example `myorg-myaccount`). LevelFour generates a key pair and a SQL script scoped to your account.

### Run the script in Snowflake

As ACCOUNTADMIN, open a Snowflake worksheet, paste the script, and run it.

The script creates a dedicated `TYPE = SERVICE` user authenticated by the key pair LevelFour generated, a new XS warehouse with `AUTO_SUSPEND = 60`, and grants that user read access only to the organization usage views LevelFour reads. It changes nothing else in your account.

### Finish in LevelFour

Return to **Connect Providers** and click **Verify**. The connection completes once the script has run.

## Confirming it worked

The connection moves to **Connected**. Your first data appears within a day.

## Rotating or removing access

### Rotating the credential

Generate a new script from **Connect Providers**. Running it issues a new key pair for the same service user; the old key stops being accepted once the new one is set.

### Removing access

Disconnect Snowflake under **Connect Providers**, then, as ACCOUNTADMIN, drop the dedicated user and warehouse the script created.

## Troubleshooting

| Symptom                                                         | What to do                                                                                                                                                 |
| --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The script runs, but no currency data ever appears              | Your account is likely reseller-contracted. Reseller accounts cannot read the organization billing views; check with your Snowflake account team           |
| The script fails to run                                         | It must run as ACCOUNTADMIN. A role with lesser privileges cannot grant the organization usage views                                                       |
| You connected a regular account and only see one account's data | Currency data is only available from the organization account or an ORGADMIN-enabled account. A plain account sees credits for itself only, never currency |

## Next

* [Connect Providers](/connectors) lists every provider you can connect
* [Databricks](/connectors/databricks) connects the same way, with a setup script instead of a pasted key
