Skip to main content

Astrato for Supabase

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 over 2 weeks ago

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

To find the session pooler string:

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

    ​

  2. Select Session pooler as the method.
    ​
    The full session pooler looks like this:

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


    Astrato requires only some parts of the session pooler URL, examples are below:

    1. Username: user.account

    2. Host: aws-0-eu-west-0.pooler.supabase.com

    3. Port: 5432

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

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 tools. Consider creating a new db user, for use with Astrato.

Did this answer your question?