Overview
The Supabase integration provides:- Direct Database Access - Connect to your Supabase PostgreSQL database to query any table
- Visual Query Builder - Build metrics using a point-and-click interface without writing SQL
- Custom SQL Queries - Write raw SQL for complex metric calculations
- Live Data - Metrics refresh automatically on configurable intervals
Prerequisites
Before connecting Supabase, you’ll need:- A Supabase project with an active PostgreSQL database
- Your Supabase Project URL (found in Project Settings)
- Your database password
For production use, we recommend creating a read-only database role with access only to the tables you need for metrics. This follows the principle of least privilege.
Connecting Supabase
Enter Integration Name
Give your integration a descriptive name (e.g., “Production Database” or “My Supabase Database”)
Enter Project URL
Find your Project URL in Supabase under Project Settings > General. It looks like:You can paste the full URL or just the project reference (e.g.,
abcdefghijkl)Enter Database Password
Find your database password in Supabase under Project Settings > Database > Connection string. This is the password you set when creating your project.
Configure Connection Pooler
Enable Use connection pooler (recommended). Connection pooling improves performance and prevents connection exhaustion.
Finding Your Supabase Credentials
Project URL
- Open your Supabase Dashboard
- Select your project
- Go to Project Settings > General
- Copy the Project URL from the API section
Database Password
- Go to Project Settings > Database
- Under Connection string, you’ll find options to reveal your password
- If you’ve forgotten your password, you can reset it from this page
Linking Metrics to Goals
Once connected, you can link Supabase database metrics to track product goal progress automatically.Configure Query
Use the Visual Builder or Raw SQL mode to define your metric (see Query Modes below)
Query Modes
Kasava provides two ways to define metrics from your Supabase database:Visual Builder
The Visual Builder lets you create metrics without writing SQL. Simply select your options from dropdown menus.| Field | Description |
|---|---|
| Table | Select any table or view from your database |
| Aggregation | Count, Sum, Average, Maximum, Minimum, or Count Distinct |
| Column | For non-count aggregations, select the column to aggregate |
| Time Column | Optional: Filter by a timestamp column |
| Time Range | Last 24 hours, 7 days, 30 days, 90 days, 365 days, or All time |
| Goal | Table | Aggregation | Column | Time Range |
|---|---|---|---|---|
| Total Users | users | Count | - | All time |
| Monthly Active Users | sessions | Count Distinct | user_id | Last 30 days |
| Total Revenue | orders | Sum | amount | Last 30 days |
| Average Order Value | orders | Average | amount | Last 7 days |
Raw SQL
For complex metrics that can’t be expressed with the Visual Builder, switch to Raw SQL mode and write your own query.Your SQL query must return exactly one row with one numeric column. Complex queries with multiple columns or rows are not supported for goal tracking.
Supported Aggregations
| Aggregation | Description | Requires Column |
|---|---|---|
| Count | Count total rows | No |
| Sum | Sum of numeric values | Yes (numeric column) |
| Average | Average of numeric values | Yes (numeric column) |
| Maximum | Highest value | Yes (numeric column) |
| Minimum | Lowest value | Yes (numeric column) |
| Count Distinct | Count unique values | Yes (any column) |
Time Filtering
When using the Visual Builder, you can optionally filter by a timestamp column:| Time Range | Description |
|---|---|
| Last 24 hours | Data from the past day |
| Last 7 days | Data from the past week |
| Last 30 days | Data from the past month |
| Last 90 days | Data from the past quarter |
| Last 365 days | Data from the past year |
| All time | No time filter applied |
timestamp, timestamptz, date, or datetime type.
Refresh Intervals
Linked metrics automatically refresh based on your configured interval:| Interval | Description |
|---|---|
| Hourly | Metrics update every hour (best for real-time monitoring) |
| Daily | Metrics update once per day (recommended for most goals) |
| Weekly | Metrics update weekly (best for long-term trends) |
Troubleshooting
Connection fails with 'Invalid credentials'
Connection fails with 'Invalid credentials'
Verify that:
- Your Project URL is correct and includes the full domain (e.g.,
abcdefghijkl.supabase.co) - Your database password is correct
- Your Supabase project is active (not paused)
Tables not appearing in the dropdown
Tables not appearing in the dropdown
- Ensure your database user has SELECT permissions on the tables
- Check that the tables exist in the
publicschema (or switch schemas in the table dropdown) - Views are also supported if you need to expose computed data
Query test returns no data
Query test returns no data
- Verify the time range includes data (try extending to 30 days or All time)
- Check that the selected table has rows
- For aggregate metrics, ensure the column contains numeric data
Connection timeout errors
Connection timeout errors
- Ensure Use connection pooler is enabled
- Check that your Supabase project isn’t paused due to inactivity
- Verify your project’s database isn’t under heavy load
Permission denied errors
Permission denied errors
Your database role may not have access to certain tables. Either:
- Grant SELECT permissions on the required tables
- Use a database role with broader read access
Security Best Practices
Use a Read-Only Role
Create a dedicated database role with read-only access to only the tables needed for metrics. This limits exposure if credentials are compromised.
Security
- Database credentials are encrypted at rest
- Credentials are never exposed in the UI after initial entry
- You can revoke access anytime by changing your database password or deleting the integration
- Kasava only performs read operations (SELECT queries)
- Connection pooler support prevents connection exhaustion