Skip to contentManaged Kafka is live: Apache Kafka on AWS for half the cost of MSK

PostgreSQL

Connect Supabase as a PostgreSQL source

Set up a Supabase project so Artie reads its changes over a direct connection, with a dedicated database user and a publication.

When you create the pipeline, choose PostgreSQL as the source and Supabase as the Hosting provider. This page covers what differs on Supabase. For partitioned tables, tables without primary keys and other settings, see the PostgreSQL overview.

Enable a dedicated IPv4 address

Supabase’s direct connection uses IPv6 unless the project has the IPv4 add-on. Artie’s fixed IP addresses are IPv4, so enable the add-on:

  1. In Supabase, open your project’s Settings, then select Add-ons.

  2. Enable Dedicated IPv4 address.

Dedicated IPv4 address is the first add-on on the page:

The Supabase Add-ons settings page with the Dedicated IPv4 address add-on highlighted

Supabase connection string

Supabase turns on logical replication by default. To confirm, run this query in your Supabase database:

SQL
SHOW wal_level;

The query returns logical.

Logical replication doesn’t work through the Supabase connection pooler, so Artie needs the direct connection. Don’t use the transaction pooler on port 6543.

On your project’s home page, open Copy and select Direct connection string:

The Copy menu on a Supabase project page with Direct connection string highlighted

If the string isn’t a direct connection, select Get Connected, open the Direct tab and set Connection Method to Direct connection. The direct connection uses port 5432:

The Supabase Connect to your project dialog with Direct connection selected

Create database access

Run this as an admin in your Supabase database. It creates Artie’s user, gives it replication access and grants it read access to current and future tables in public:

setup.sql
CREATE USER artie WITH PASSWORD 'PASSWORD';
ALTER USER artie REPLICATION;

GRANT USAGE ON SCHEMA public TO artie;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO artie;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO artie;

Replace PASSWORD with a password for the user. Repeat the three grants for each other schema you want to replicate tables from.

Create the publication

Artie reads changes through a publication named dbz_publication, which you create. Run this as an admin that owns the tables:

publication.sql
CREATE PUBLICATION dbz_publication FOR ALL TABLES WITH (publish_via_partition_root = true);

publish_via_partition_root needs PostgreSQL 13 or later. On PostgreSQL 12 or earlier, leave out the WITH clause and turn off Publish via partition root when you connect the source. To use a publication you already have, enter its name in Publication instead.

Connect Supabase in Artie

Create the pipeline in the setup flow:

  1. On Choose your source, select PostgreSQL, then select Continue.

  2. On How would you like to connect your source?, choose SSH tunnel, Allowlist Artie IPs or PrivateLink.

  3. On Prepare your PostgreSQL database, set Hosting provider to Supabase, then select Continue.

  4. On Connect PostgreSQL, enter the values from the direct connection string, listed in the table after these steps.

  5. Select Verify source. When it shows Source verified, select Continue.

If you reuse a PostgreSQL connector that’s already set up, setup passes the network and prepare steps.

Enter these values on Connect PostgreSQL:

FieldValue
HostThe host from the direct connection string, for example db.example.supabase.co
Port5432
Userartie
PasswordThe password you set for artie
Database nameThe database your tables are in, postgres in the direct connection string

Publish via partition root is on by default and must match the publication. Turn it off only if you created the publication without the WITH clause.

Next steps

Was this page helpful?