# Snowflake Tools

The Snowflake Tools allow DinoAI to explore your Snowflake account — listing databases, schemas, tables, and columns — and to analyse the performance of specific queries in depth. This gives DinoAI the context it needs to help you write accurate SQL, build dbt models, and diagnose cost or performance issues, all without leaving Paradime.

{% hint style="info" icon="plug-circle-plus" %}
**Requires a Snowflake connection.** These tools are only available when your workspace is connected to Snowflake. See your workspace settings to [configure a Snowflake credential](https://docs.paradime.io/app-help/documentation/settings/connections/development-environment/snowflake).
{% endhint %}

#### Capabilities

The Snowflake Tools give DinoAI the following abilities:

* List all databases in your Snowflake account
* List all schemas within a given database
* List all tables within a given database and schema, including row counts, size in bytes, and creation timestamps
* Inspect column names, types, and comments for any table using `DESCRIBE TABLE`
* Retrieve comprehensive performance statistics for a specific query, including execution plan operator stats, bytes scanned, spill metrics, cache efficiency, and queue times

#### Using the Snowflake Tools

1. Open DinoAI in the right panel of the Code IDE
2. Describe what you want to explore or investigate (e.g., a table name, a Snowflake query ID, or a question about performance)
3. Add your prompt describing what you want DinoAI to do with that information
4. Grant permission when DinoAI asks to access your Snowflake account
5. Review the results and implement DinoAI's suggested actions

#### Example Use Cases

**Generating a dbt Source File**

**Prompt**

```
List the columns in the `RAW.PUBLIC.ORDERS` table and generate a dbt sources.yml file.
```

**Result:** DinoAI runs `DESCRIBE TABLE RAW.PUBLIC.ORDERS`, fetches all column names, types, and comments, and produces a ready-to-use `sources.yml` file with the correct structure and any available column descriptions pre-filled.

**Diagnosing a Slow Query**

**Prompt**

```
The query 01b3f2c4-0000-1234-abcd-ef0123456789 was slow last night. What went wrong?
```

**Result:** DinoAI queries `SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY` for overall metrics (total elapsed time, compilation time, bytes scanned, cache hit rate, spill to local/remote storage) and `GET_QUERY_OPERATOR_STATS()` for step-level operator statistics. It then surfaces the bottleneck — such as excessive remote spillage or a large join — and recommends optimisations.

**Exploring an Unfamiliar Database**

**Prompt**

```
What schemas and tables are in my `ANALYTICS` database?
```

**Result:** DinoAI lists all schemas in the database, then lists the tables within each (including row counts and sizes), giving you a complete picture before writing queries or building models.

#### Working with Other Tools

The Snowflake Tools work well alongside DinoAI's other capabilities:

* Combine with the **dbt Tools** to inspect Snowflake source tables and immediately scaffold dbt models or source definitions
* Combine with the **Catalog Search Tool** to cross-reference Snowflake table structure with existing dbt model documentation
* Combine with the **Column Level Lineage Tool** to trace how a specific column flows from a raw Snowflake table through your dbt transformations

#### Best Practices

* **Use uppercase identifiers** — Snowflake stores unquoted identifiers in uppercase; DinoAI normalises identifiers to uppercase automatically, but being consistent in your prompts avoids confusion
* **Use the three-part identifier** — Snowflake tables are referenced as `DATABASE.SCHEMA.TABLE`; providing all three parts helps DinoAI navigate directly to the right resource
* **Provide a valid UUID for performance queries** — The query performance tool requires a valid Snowflake query UUID; you can find this in the Snowflake Query History UI or in query logs
* **Check permissions** — DinoAI surfaces a `[ERROR]` if it cannot access a resource; confirm your Snowflake role has access to `SNOWFLAKE.ACCOUNT_USAGE` for performance queries and the necessary privileges on target databases
