Replicate Supabase PostgreSQL tables with continuous CDC on Postgres 17+, with batch fallback for older projects.
When Supabase OAuth is available, Contrast detects the project's Postgres version during onboarding. Projects on Postgres 17 or newer default to an initial full load followed by continuous change data capture through Embrasure Flow. Older projects keep cursor-based or xmin batch ingestion until they are upgraded and reconnected.
Connect with Supabase OAuth. Contrast keeps catalog discovery on its existing pooled read-only role and provisions a separate direct role with REPLICATION, BYPASSRLS, database CONNECT, schema USAGE, and table SELECT for CDC. This lets replication copy complete rows while application users keep their existing row-level security policies.
Contrast uses the authorized Supabase management connection to create a publication for the selected tables for each sync generation, including full resyncs. The replication login does not need table ownership or database CREATE. Re-checking setup repairs older Contrast replication logins automatically while the Supabase authorization remains valid.
The CDC path requires:
Preflight verifies the direct endpoint, logical replication settings, role privileges, replication capacity, table keys, and supported column types before Flow starts.
Projects below Postgres 17 use scheduled batch ingestion:
updated_at-style cursor that changes whenever the row changes.xmin only when no reliable cursor is available. It can increase source load because a run may need to scan the table.Cursor and xmin ingestion do not detect hard deletes. Represent deletion state in a source column when downstream users need it.
Supabase keeps sign-ups and sign-ins in the auth schema, which is not readable by a normal database role. To answer questions like weekly active users, an OAuth connection also creates read-only views of selected auth.users and auth.sessions columns, including each user's email and sign-in times:
embrasure_auth.users: id, aud, role, email, created_at, updated_at, last_sign_in_at, confirmed_at, email_confirmed_at, phone_confirmed_at, invited_at, banned_until, deleted_at, is_anonymous, is_sso_user, provider (the sign-up provider from raw_app_meta_data), and last_active_at (the latest of created_at, updated_at and last_sign_in_at).embrasure_auth.sessions: id, user_id, created_at, updated_at, refreshed_at (read as UTC), not_after, aal, and last_active_at (the latest of created_at, updated_at and refreshed_at).The views never include passwords, confirmation, recovery or reauthentication tokens, pending email or phone changes, phone numbers, raw_user_meta_data, IP addresses or user agents. Columns that do not exist in your project's Auth version are left out.
On hosted Supabase the postgres role cannot grant auth access to another role, so Contrast does not change any auth grants. Instead, postgres owns two objects per table in the private embrasure_auth schema: a function (read_users(), read_sessions()) that runs as postgres and reads only the columns above, and a view over it. Only the Contrast read-only role can execute the functions and select from the views. The schema is not exposed through the Data API, and PUBLIC, anon and authenticated have no access. If the project does not let postgres read auth, the connection works without these views.
The functions read auth with dynamic SQL, so nothing in embrasure_auth depends on an auth column or type, and Supabase Auth upgrades can change or drop any column. When an upgrade changes a column the views read, syncing those views fails until Contrast next refreshes its Supabase authorization and rebuilds them; other tables keep syncing. If an Auth upgrade ever fails because of Contrast's objects, drop the schema (below) and retry the upgrade. Reconnecting Supabase creates it again.
The views sync with Scheduled sync, using last_active_at as the cursor. They cannot use continuous CDC or xmin, because views cannot be published and have no row versions. When Contrast sets up continuous sync for a project, it adds a separate Scheduled sync for the views. Each read scans the Auth table, so reads use large pages, time out after a minute, and give up quickly instead of waiting behind a Supabase Auth migration; the next run retries.
Supabase deletes a session when the user signs out or it expires, and last_sign_in_at keeps only the latest sign-in. Synced session rows stay in the warehouse, so activity history starts at the first sync: weekly active users computed from these tables covers sign-ins and token refreshes from then on, plus the latest sign-in of each user. It does not reconstruct earlier weeks.
To stop sharing Auth data, drop the schema:
drop schema embrasure_auth cascade;To remove one connection's access, revoke it from that connection's role (the embrasure_ingest_… role shown in Supabase under Database > Roles):
revoke usage on schema embrasure_auth from embrasure_ingest_<suffix>;Contrast checks the views when it refreshes its Supabase authorization. A dropped schema or revoked access stays that way. Reconnecting Supabase creates the views and grants access again. Connections made before this feature existed get the views when they reconnect.
When OAuth is not available, Contrast asks for a read-only Supabase Session pooler connection. In Supabase, open Connect, choose Session pooler, and copy the exact URI. The username must include the project reference, the port should be 5432, and SSL must be required.
Manual Session pooler connections use scheduled batch ingestion rather than continuous CDC. Use a dedicated read-only role with database CONNECT, schema USAGE, and table SELECT only. Do not use the project owner or service role.
Create a Supabase source and follow the connection method shown in Contrast. After verification, select the schemas and tables and choose a destination database. OAuth-connected Postgres 17+ projects default to full load and continuous CDC. Older projects and manual Session pooler connections use batch sync.