Skip to main content

Connecting Supabase to Astrato Analytics

Astrato connects to Supabase for low-cost, scalable analytics in the cloud, using a managed PostgreSQL service.

Piers Batchelor avatar
Written by Piers Batchelor
Updated yesterday

Navigate to Data + AI Connection area in Astrato (Direct link: https://app.astrato.io/data/sources)


You need to have at minimum Administrator/Creator permissions in Astrato & access to your Supabase tenant.

Create a new connection:
​

This will bring you to the "Connect to Supabase" dialogue. To successfully connect, you need to obtain the Supabase connection URL:

Obtaining the Supabase Connection URL

  1. Click on πŸ”ŒConnect, which appears at the very top of Supabase Studio's UI.
    ​

Connecting via IPV4 direct connection (recommended)

  1. ​Select Direct connection as the method, choose the IPV4 option.

Connecting via the Session Pooler (free projects)

To connect Astrato to Supabase, first, find the Session pooler connection string to Astrato

  • Transaction pooler connections are IPv4 proxied for free.

  • Ideal for stateless applications like serverless functions where each interaction with Postgres is brief and isolated.

To find the session pooler string:

Click on πŸ”ŒConnect, which appears at the very top left of Supabase Studio's UI.
​

[1] Select Session pooler as the method.
​


​

[2] Take the URL of the full session pooler looks like this:

postgresql://postgres.abcdefghijklmnop:[YOUR-PASSWORD]@aws-1-eu-west-2.pooler.supabase.com:5432/postgres


​

[3] Paste the URL into the Astrato Data Connection Dialogue. By default, SSL mode is set to require, we recommend using this.
​

[4] One successfully connected, select your database

[4] You can then add permission who within your Astrato tenant will have access to read from the database using the credentials, as well as the ability to create Semantic Layers.​

[5] Once successfully connected, you a new Semantic Layer will be created, where you can browse available tables, schemas and query them.


​

Video coming soon


​

πŸ§‘β€πŸ’» Optional: SQL Code to create a new user in Supabase for Astrato Analytics

create user astrato with password '--ENTER YOUR PASSWORD--';

GRANT CONNECT ON DATABASE postgres TO astrato;

-- 3. Grant usage on the 'public' schema (where your tables usually live)
GRANT USAGE ON SCHEMA public TO astrato;

-- 4. Grant access to all EXISTING tables in the public schema
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO astrato;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO astrato;

-- 5. (Optional) Grant access to all FUTURE tables automatically
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO astrato;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO astrato;

alter default privileges in schema public
grant select, insert, update, delete on tables to astrato;

ALTER ROLE astrato LOGIN;

ℹ️ We recommend not to use the default account to connect to third party tools integrating with Supabase. Consider creating a new db user, for use with Astrato.

Did this answer your question?