# Snowflake

{% hint style="warning" %}
**IP RESTRICTIONS**

Make sure to allow traffic from one of the Paradime IPs in your firewall depending on the data location selected.

👉 See also: [Paradime IP addresses](https://docs.paradime.io/app-help/developers/ip-restrictions).
{% endhint %}

{% hint style="info" %}
We recommend creating a dedicated Snowflake service user for the DinoAI agent environment, with the minimum permissions required to create tables and views in your database.
{% endhint %}

### Create a new Snowflake user

Execute the SQL commands below in Snowflake to create a dedicated service user for the DinoAI agent environment.

#### Suggested permissions

This set of permissions will enable DinoAI to read from and create tables and views during background agent sessions in your Snowflake database.

```sql
use role securityadmin;

-- create warehouse if not exists
create warehouse transforming
    warehouse_size = xsmall
    auto_suspend = 60
    auto_resume = true
    initially_suspended = true;

-- create role and grant warehouse permission
create role transformer;
grant all on warehouse transforming to role transformer;

-- create DinoAI agent service user
create user paradime_dinoai_user
    password = '<generate_password>'
    default_warehouse = transforming
    default_role = transformer;

-- grant role to paradime_dinoai_user
grant role transformer to user paradime_dinoai_user;

-- grant permission to allow role to read from your source database
grant usage on database <your_database_name> to role transformer;
grant usage on future schemas in database <your_database_name> to role transformer;
grant select on future tables in database <your_database_name> to role transformer;
grant select on future views in database <your_database_name> to role transformer;
grant usage on all schemas in database <your_database_name> to role transformer;
grant select on all tables in database <your_database_name> to role transformer;
grant select on all views in database <your_database_name> to role transformer;

-- grant permission to allow role to write to your database
grant all on database analytics to role transformer;
```

### Add the DinoAI agent environment connection

To add the Snowflake DinoAI agent environment connection, follow these instructions:

1. Click **Settings** in the top menu bar of the Paradime interface to access **Account Settings**
2. In the left sidebar, click **Connections**
3. Click **Add New** next to the **DinoAI Background Agent Environment** section
4. Select **Snowflake** and fill out the corresponding fields.

### Using username and password

<figure><img src="https://2337193041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHET0AD04uHMgdeLAjptq%2Fuploads%2FP5wUEDMtkSJVLcQhwDDt%2Fprod_connection_snowflake_u%26p.png?alt=media&#x26;token=2c16a45a-2510-44d2-81cd-5527713e3a1a" alt="" width="540"><figcaption></figcaption></figure>

#### Field details

| Field     | Description                                                                                                                                              | Example                     |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| Profile   | The profile name set in your `dbt_project.yaml`. See more [here](https://docs.getdbt.com/docs/core/connect-data-platform/connection-profiles).           | **`dbt-snowflake`**         |
| Target    | The target name used to identify the DinoAI agent environment connection. See more [here](https://docs.getdbt.com/reference/dbt-jinja-functions/target). | **`dinoai`**                |
| Account   | The Snowflake account to connect to as per [Snowflake's documentation](https://docs.snowflake.com/en/user-guide/admin-account-identifier).               | **`vj71689.eu-west-2.aws`** |
| Role      | The role to assume when running queries as the DinoAI agent service user.                                                                                | **`transformer`**           |
| Database  | The name of the Snowflake database the DinoAI agent will query and build objects in.                                                                     | **`analytics`**             |
| Warehouse | The virtual warehouse to use for running queries during DinoAI background agent sessions.                                                                | **`transforming`**          |
| Username  | The DinoAI agent service user created with access to the database.                                                                                       | **`paradime_dinoai_user`**  |
| Password  | The password set for the DinoAI agent service user.                                                                                                      | **`password_xyz`**          |
| Schema    | The default schema used to build dbt™ objects during DinoAI background agent sessions.                                                                   | **`dbt_dinoai`**            |
| Threads   | The number of threads used in this connection. See more [here](https://docs.getdbt.com/docs/running-a-dbt-project/using-threads).                        | **`8`**                     |

### Using key-pair authentication

In Paradime you can use key-pair authentication to connect your DinoAI agent environment using a private key and optionally a private key passphrase.

After [generating an encrypted or unencrypted key pair](https://docs.snowflake.com/en/user-guide/key-pair-auth#configuring-key-pair-authentication), set the `rsa_public_key` for the DinoAI agent service user:

```sql
alter user paradime_dinoai_user set rsa_public_key='MIIBIjANBgkqh...';
```

<figure><img src="https://2337193041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHET0AD04uHMgdeLAjptq%2Fuploads%2FODTq0P9QLwlemzTeVYdF%2Fprod_connection_snowflake_key_pair.png?alt=media&#x26;token=c2361469-38aa-4167-9518-a05fa8d57dc4" alt="" width="540"><figcaption></figcaption></figure>

#### Field details

| Field                             | Description                                                                                                                                              | Example                                                                                                      |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Profile                           | The profile name set in your `dbt_project.yaml`. See more [here](https://docs.getdbt.com/docs/core/connect-data-platform/connection-profiles).           | **`dbt-snowflake`**                                                                                          |
| Target                            | The target name used to identify the DinoAI agent environment connection. See more [here](https://docs.getdbt.com/reference/dbt-jinja-functions/target). | **`dinoai`**                                                                                                 |
| Account                           | The Snowflake account to connect to as per [Snowflake's documentation](https://docs.snowflake.com/en/user-guide/admin-account-identifier).               | **`vj71689.eu-west-2.aws`**                                                                                  |
| Role                              | The role to assume when running queries as the DinoAI agent service user.                                                                                | **`transformer`**                                                                                            |
| Database                          | The name of the Snowflake database the DinoAI agent will query and build objects in.                                                                     | **`analytics`**                                                                                              |
| Warehouse                         | The virtual warehouse to use for running queries during DinoAI background agent sessions.                                                                | **`transforming`**                                                                                           |
| Username                          | The DinoAI agent service user created with access to the database.                                                                                       | **`paradime_dinoai_user`**                                                                                   |
| Private Key                       | The private key generated and linked to the DinoAI agent service user. You **must** include the commented lines when adding the private key.             | **`-----BEGIN ENCRYPTED PRIVATE KEY----- < private key content here > -----END ENCRYPTED PRIVATE KEY-----`** |
| Private Key Passphrase (Optional) | The passphrase created when generating the encrypted key.                                                                                                | **`passphrase_xyz`**                                                                                         |
| Schema                            | The default schema used to build dbt™ objects during DinoAI background agent sessions.                                                                   | **`dbt_dinoai`**                                                                                             |
| Threads                           | The number of threads used in this connection. See more [here](https://docs.getdbt.com/docs/running-a-dbt-project/using-threads).                        | **`8`**                                                                                                      |


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paradime.io/app-help/documentation/settings/connections/dinoai-background-agent-environment/snowflake.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
