# Supabase

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

Connect Supabase to Better Analyst using your Postgres credentials. Includes Session pooler guidance, SSL defaults, optional read-only user setup, and public schema recommendations.

Connect your Supabase Postgres database to Better Analyst to analyze tables with natural language, charts, and dashboards.

## Prerequisites

- A Supabase project
- Database password for the `postgres` role or another database login you control
- Network access to your Supabase pooler host
- A schema with read access, typically `public`

## Recommended Connection Settings

Use the **Session pooler** connection details from the Supabase **Connect** dialog. Supabase recommends Session pooler for persistent client traffic and environments that need IPv4 compatibility.

| Field | Description | Example |
| - | - | - |
| Host | Session pooler hostname | `aws-1-us-east-2.pooler.supabase.com` |
| Port | Postgres port | `5432` |
| Database | Database name | `postgres` |
| Username | Database user | `postgres.your-project-ref` |
| Password | Database password | `********` |
| SSL Mode | SSL connection mode | `require` |
| Schema | Default schema | `public` |

Supabase API keys like `anon` and `service_role` are not database credentials. Better Analyst connects through Postgres, so use the database password instead.

## Optional: Create a Dedicated Read-Only User

Supabase recommends creating a separate Postgres user for external services instead of reusing the `postgres` role. If you want Better Analyst isolated to read-only access on your application tables, create a dedicated login like this:

```sql
CREATE ROLE formulabot WITH LOGIN PASSWORD 'replace-with-a-strong-password';

GRANT CONNECT ON DATABASE postgres TO formulabot;
GRANT USAGE ON SCHEMA public TO formulabot;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO formulabot;

ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO formulabot;
```

If your app tables live outside `public`, grant access to that schema instead and use the same schema name in Better Analyst.

## Finding Your Credentials

1. Open your Supabase project.
2. Click **Connect**.
3. Select the **Session pooler** string.
4. Copy the host, port, username, and database values.
5. Use your database password for the `postgres` role.

If you do not know the password, reset it in **Database Settings** inside Supabase.

If you are pasting a full connection string and your password contains special characters, URL-encode the password first.

## Choosing the Right Connection Type

### Session Pooler

Use this by default. It is the best fit for Better Analyst, deployed apps, and most hosted environments.

### Direct Connection

Use the direct `db.<project-ref>.supabase.co:5432` host only if your environment supports it and you intentionally want a direct database path. Supabase notes that direct connections typically rely on IPv6 unless you have the IPv4 add-on.

### Transaction Pooler

Better Analyst’s Supabase connector is designed around the Session pooler and direct Postgres connection paths. Stick with Session pooler unless you have a specific operational reason to do otherwise.

## Connect in Better Analyst

1. Go to **Connectors**.
2. Select **Supabase**.
3. Enter your host, port, database, username, and password.
4. Keep **SSL Mode** set to `require`.
5. Keep the schema set to `public` unless you intentionally want another schema.
6. Click **Test Connection** and save.

## Why Session Pooler Is Recommended

Supabase provides multiple Postgres connection options. Session pooler is the best default for Better Analyst because it works well in hosted environments and avoids common IPv6 or direct-connection issues.

Use the direct host only if your environment explicitly supports it and you know you want a non-pooler connection.

## Example Questions

- "Show me the first 10 rows from events"
- "What event types are most common this week?"
- "Create a daily signup trend from my public.users table"
- "Build a dashboard for weekly active users and retention"
- "Which plans convert best from trial to paid?"
- "What tables in public look related to subscriptions or invoices?"

## Security Notes

- Credentials are stored encrypted
- Queries are read-only
- SSL is enabled with `require`
- Keep access scoped to the tables and schema you actually want analyzed
- Prefer a dedicated read-only database user when possible

## Troubleshooting

### Authentication Failed

- Verify you used the database password, not an API key
- Confirm the username matches the connection string from Supabase Connect
- Reset the database password in Supabase if needed

### Connection Works in Supabase but Not in Better Analyst

- Use the session pooler host instead of the direct database host
- Confirm the port is `5432`
- Keep SSL mode set to `require`
- Confirm the database is usually `postgres`

### Password Parsing Errors

- If you are using a full connection string, URL-encode passwords that contain special characters
- Paste separate host, port, username, and password fields when possible to avoid encoding mistakes

### No Tables Found

- Check that your tables live in the selected schema
- Make sure the connected user can read the schema and tables
- Confirm you are looking in `public` if that is where your app tables live

## Next Steps

- [Learn about asking questions](https://betteranalyst.com/docs/ai-chat/asking-questions)
- [Create charts and visualizations](https://betteranalyst.com/docs/ai-chat/charts-visualizations)
- [Connect PostgreSQL](https://betteranalyst.com/docs/connectors/postgresql)
- [Configure Knowledge Base](https://betteranalyst.com/docs/my-data/knowledge-base)
- [Connect Snowflake](https://betteranalyst.com/docs/connectors/snowflake)
