# Snowflake

- URL: https://betteranalyst.com/docs/connectors/snowflake
- Updated: 2026-11-12
- Author: Better Analyst

Connect Snowflake to Better Analyst with step-by-step user and role setup, warehouse configuration, multi-schema access, and cost optimization tips.

Connect your Snowflake data warehouse to analyze data using natural language queries and create visualizations.

## Prerequisites

- A Snowflake account
- User credentials with appropriate permissions
- Warehouse access for running queries

## Connection Details

| Field | Description | Example |
| - | - | - |
| Account | Snowflake account identifier | `xy12345.us-east-1` |
| Username | Snowflake user | `FORMULABOT_USER` |
| Password | User password | `********` |
| Warehouse | Compute warehouse | `COMPUTE_WH` |
| Database | Default database | `ANALYTICS` |
| Schema | Default schema (optional) | `PUBLIC` |
| Role | User role (optional) | `ANALYST` |

## Setup Steps

### 1. Create a User for Better Analyst

```sql
-- Create a role for Better Analyst
CREATE ROLE FORMULABOT_ROLE;

-- Grant warehouse usage
GRANT USAGE ON WAREHOUSE COMPUTE_WH TO ROLE FORMULABOT_ROLE;

-- Grant database access
GRANT USAGE ON DATABASE ANALYTICS TO ROLE FORMULABOT_ROLE;
GRANT USAGE ON SCHEMA ANALYTICS.PUBLIC TO ROLE FORMULABOT_ROLE;
GRANT SELECT ON ALL TABLES IN SCHEMA ANALYTICS.PUBLIC TO ROLE FORMULABOT_ROLE;
GRANT SELECT ON FUTURE TABLES IN SCHEMA ANALYTICS.PUBLIC TO ROLE FORMULABOT_ROLE;

-- Create the user
CREATE USER FORMULABOT_USER
  PASSWORD = 'your-secure-password'
  DEFAULT_ROLE = FORMULABOT_ROLE
  DEFAULT_WAREHOUSE = COMPUTE_WH
  DEFAULT_NAMESPACE = ANALYTICS.PUBLIC;

-- Assign the role
GRANT ROLE FORMULABOT_ROLE TO USER FORMULABOT_USER;
```

### 2. Find Your Account Identifier

Your account identifier is in your Snowflake URL:

- `https://xy12345.us-east-1.snowflakecomputing.com`
- Account identifier: `xy12345.us-east-1`

Or check in Snowflake:

```sql
SELECT CURRENT_ACCOUNT();
```

### 3. Connect in Better Analyst

1. Go to **Connectors** > **Add Connector**
2. Select **Snowflake**
3. Enter your connection details
4. Click **Test Connection**
5. Save when successful

The warehouse must be running for the connection test. Better Analyst will use it for all queries.

## Warehouse Configuration

Choose an appropriate warehouse:

| Size | Best For |
| - | - |
| X-Small | Simple queries, small datasets |
| Small | Typical analytical queries |
| Medium | Complex joins, large aggregations |

Better Analyst uses your specified warehouse for all queries. Monitor usage in Snowflake's billing section.

## Example Questions

### Basic Analysis

- "Show me the schema of the orders table"
- "How many records are in the customers table?"
- "List all tables in the analytics database"

### Business Questions

- "What were total sales last quarter?"
- "Show the top 20 products by revenue"
- "Calculate customer lifetime value by segment"

### Time Series

- "Show daily active users trend"
- "Compare this month to the same month last year"
- "What's the weekly growth rate?"

### Complex Analysis

- "Calculate cohort retention over 12 months"
- "Find products frequently bought together"
- "Segment customers by purchase behavior"

## Working with Multiple Schemas

Grant access to additional schemas as needed:

```sql
GRANT USAGE ON SCHEMA ANALYTICS.MARKETING TO ROLE FORMULABOT_ROLE;
GRANT SELECT ON ALL TABLES IN SCHEMA ANALYTICS.MARKETING TO ROLE FORMULABOT_ROLE;
```

Reference schemas in your questions:

- "Query the marketing.campaigns table"
- "Show data from sales.transactions"

## Data Sharing

If you use Snowflake Data Sharing:

1. Grant access to shared databases:

```sql
GRANT IMPORTED PRIVILEGES ON DATABASE shared_data TO ROLE FORMULABOT_ROLE;
```

2. Reference shared data in queries normally

## Troubleshooting

### Connection Failed

- Verify account identifier format
- Check username and password
- Ensure the warehouse exists and you have usage rights

### Warehouse Suspended

- The warehouse may be auto-suspended
- Better Analyst will auto-resume it if configured
- Check warehouse auto-resume settings

### Permission Errors

- Verify role has SELECT on the tables
- Check USAGE on database and schema
- Confirm warehouse access is granted

### Query Timeout

- Increase warehouse size for complex queries
- Add filters to reduce data processed
- Ask for aggregated results

## Cost Optimization

### Warehouse Size

Use the smallest warehouse that meets your needs. X-Small is often sufficient for typical queries.

### Auto-Suspend

Configure your warehouse to auto-suspend when idle:

```sql
ALTER WAREHOUSE COMPUTE_WH SET AUTO_SUSPEND = 60;
```

### Query Efficiency

Better Analyst optimizes queries, but you can help by:

- Specifying date ranges
- Asking for aggregates instead of raw data
- Limiting result sets

## Next Steps

- [Connect Supabase](https://betteranalyst.com/docs/connectors/supabase)
- [Learn about asking questions](https://betteranalyst.com/docs/ai-chat/asking-questions)
- [Create charts and visualizations](https://betteranalyst.com/docs/ai-chat/charts-visualizations)
