> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/snowflake/connect-snowflake.md).

# Connect Snowflake

### Connect with a password or private key

Click the node to open its settings, then select **New connection**.

![](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FQNnY1m3AS9XAteilvg8k%2Fimage.png?alt=media)

Enter the required connection details into the form according to the table and notes below:

| Field                      | Value                                                       |
| -------------------------- | ----------------------------------------------------------- |
| **Connection Name**        | This is whatever you want to name the connection            |
| **User**                   | Your chosen Snowflake account username                      |
| **Password (Optional)**    | Your chosen Snowflake account password                      |
| **Private Key (Optional)** | Only if using key-pair authentication                       |
| **Account**                | Your account identifier (see where to find below)           |
| **Warehouse**              | Your warehouse name (see where to find below)               |
| **Role**                   | A role granted to the user with access to the required data |
| **Database**               | Your database name (see where to find below)                |
| **Schema**                 | Your schema name (see where to find below)                  |

{% hint style="info" %}
**Note**: Use one authentication method: enter Password, or enter an unencrypted RSA Private Key in PEM format and leave Password blank. Include the private key’s BEGIN and END lines.
{% endhint %}

### Account

This is your account identifier. Find it here:

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FAsnKC6SlxOL50RFaHYgO%2Fimage.png?alt=media)

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FVLp1gvqPP2K2NMvK5AUY%2Fimage.png?alt=media)

### Warehouse

Find it here:

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2Fopcuxfy4r5SFzRPlcAM4%2Fimage.png?alt=media)

### Role

Use a role granted to the connection user. For read queries, grant USAGE on the warehouse, database, and schema, plus SELECT on the required tables or views. Add write privileges only for actions that modify data. Do not use ACCOUNTADMIN as the runtime connection role simply to bypass missing permissions.

Find the available role here:

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FJiE6bMTBQ9F4h4DRouMa%2Fimage.png?alt=media)

### Database

Find it here:

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FIMe885zJdRI3iCpeQvMX%2Fimage.png?alt=media)

### Schema

Find it here:

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FVbVNvakwJTKU9BXovi7v%2Fimage.png?alt=media)

### Connecting to Snowflake — OAuth2

For your organization's users to connect to Snowflake using OAuth2, you must first create an OAuth2 App inside Snowflake. Once this app is created, users can use it to sign-into Snowflake via OAuth2 in third-party applications.

Have a Snowflake administrator create the security integration below. This setup task requires administrative privileges; it does not determine the role that StackAI should use to query data. Replace `<STACKAI_REDIRECT_URI>` with the redirect URI shown in your StackAI connector configuration before running the script.

```sql
CREATE SECURITY INTEGRATION STACKAI_OAUTH_APP
  TYPE = OAUTH
  ENABLED = TRUE
  OAUTH_CLIENT = CUSTOM
  OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'
  OAUTH_REDIRECT_URI = '<STACKAI_REDIRECT_URI>'
  OAUTH_ISSUE_REFRESH_TOKENS = TRUE
  OAUTH_REFRESH_TOKEN_VALIDITY = 7776000  -- ~90 days
  BLOCKED_ROLES_LIST = ('SYSADMIN');      -- optional: prevent high-privilege roles
;
```

Once the integration has been created, run the following to get a `client_id` and `client_secret`:

```sql
SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('STACKAI_OAUTH_APP');
```

Store this information as you will need it to make an OAuth2 connection.

#### Creating a custom OAuth connector

To use your personal Snowflake OAuth client in StackAI, you need to first create a custom connector in **Settings -> Connectors**. Here, select **+ New Connector.**

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FoZwP99GyK7IEGr0hsPLd%2FScreenshot%202026-02-03%20at%202.16.23%E2%80%AFPM.png?alt=media)

Select **Snowflake (OAuth2)** and **Create Connector**.

Once you've created a new connector, it will be in draft until you add the required fields. Edit the Connector and add the client ID and client secret from Snowflake.

You have the option of setting custom scopes for your connector. If you'd like the connections your users make to always use a specific Snowflake role, replace the placeholder `session:role:PUBLIC` scope with `session:role:{YOUR_ROLE}`. If you'd like your connection to inherit the user's default role, you can just delete this placeholder scope.

Make sure the required fields are filled in, then hit **Save**.

#### Creating a connection with your Connector

When entering the new connection dialog, select Snowflake, then select the Connector you created. You should be redirected to sign in to Snowflake.

![Connect Snowflake setup](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2Fi5IUqv0W5Ob1iSHnGHoE%2Fsnowflake_sign_on.gif?alt=media)

## Connection fields and action reference

See [Snowflake](https://docs.stackai.com/integrations/catalog/snowflake.md) for the current connector fields and supported actions.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/snowflake/connect-snowflake.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
