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

# Snowflake

> Connect your Snowflake account and sync tables into Rippit on a schedule.

Rippit reads tables from your own Snowflake account and keeps a copy in sync. Each imported table becomes a Rippit data table you can query, analyze and join to conversations.

A **connection** is Rippit's login to your Snowflake account. An **import** is a scheduled sync of one Snowflake table into a Rippit data table.

## How it works

1. **Give Rippit a Snowflake user.** Rippit needs a service user with its public key, a role that can read your tables, and a warehouse. It logs in with its own key pair, so you never send a password or private key. `list_snowflake_connections` returns Rippit's `public_key` and the [setup script](#setup-script) below, filled in for your workspace. The script is optional; any user, role and warehouse with the same access works.
2. **Create the connection.** Pass the account, user, role and warehouse to `manage_snowflake_connection` with `action: "create"`. Rippit logs in to verify it.
3. **Pick tables.** `list_snowflake_tables` lists what the connection can read. `describe_snowflake_table` shows a table's columns, so you can choose its primary key and updated-at column. Views can't be imported.
4. **Start the import.** `manage_snowflake_import` with `action: "create"` runs a full sync right away, then repeats every `cadence_hours`. Queries run on your warehouse.
5. **Watch it.** `list_snowflake_imports` shows each import's status, rows written and last error.

## Setup script

Run as `ACCOUNTADMIN`. Replace each `<placeholder>`; `list_snowflake_connections` returns this script with Rippit's public key already filled in.

```sql theme={null}
USE ROLE ACCOUNTADMIN;

-- Skip if you use an existing warehouse.
CREATE WAREHOUSE IF NOT EXISTS <warehouse>
  WAREHOUSE_SIZE = XSMALL AUTO_SUSPEND = 60 AUTO_RESUME = TRUE INITIALLY_SUSPENDED = TRUE;

CREATE ROLE IF NOT EXISTS <role>;
GRANT USAGE ON WAREHOUSE <warehouse> TO ROLE <role>;

-- Repeat for each database Rippit should read.
GRANT USAGE ON DATABASE <database> TO ROLE <role>;
GRANT USAGE ON ALL SCHEMAS IN DATABASE <database> TO ROLE <role>;
GRANT SELECT ON ALL TABLES IN DATABASE <database> TO ROLE <role>;
GRANT SELECT ON FUTURE TABLES IN DATABASE <database> TO ROLE <role>;

CREATE USER IF NOT EXISTS <user>
  TYPE = SERVICE
  DEFAULT_ROLE = <role>
  DEFAULT_WAREHOUSE = <warehouse>
  RSA_PUBLIC_KEY = '<public_key>';
GRANT ROLE <role> TO USER <user>;

-- Optional: easy auto ETL definitions (reuses the keys your pipelines already MERGE on).
GRANT DATABASE ROLE SNOWFLAKE.GOVERNANCE_VIEWER TO ROLE <role>;
```

The optional last grant lets Rippit read `SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY`. From the last 7 days of `MERGE`, `DELETE` and `UPDATE` statements, and dbt incremental builds, it finds the keys and watermark column each table is loaded on, and suggests them as the import's `primary_keys` and `updated_at_column`. Without it, imports work the same; you choose the keys yourself.

## Managing imports

`manage_snowflake_import` also takes `update`, `run`, `pause`, `resume`, `reset` and `delete`.

* Changing `primary_keys` or `updated_at_column` replaces the import with a new table and a full re-pull.
* `delete` removes the table from Rippit's table list. Rows already imported stay stored.
* A failed import usually needs a fix in Snowflake, such as a permission or a dropped column. Fix it, then use `run`.

## Fixing a connection

A connection that can't log in comes back inactive with a `setup_error`. Fix the issue in Snowflake, then call `manage_snowflake_connection` with `action: "update"`. `update` also reconnects a disconnected connection. To change the account, user or region of a verified connection, create a new one.

## Operations

See the operation pages in this section for every parameter.


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