Skip to content

Supabase

import { Aside } from ‘@astrojs/starlight/components’;

The Supabase adapter extends the Postgres adapter with Supabase platform features: Row Level Security, Realtime, pgvector, pg_cron, and Supabase Wrappers (FDW).

warehouse:
kind: supabase
projectRef: abcdefghijklmnop # from your Supabase dashboard URL
serviceRoleKey: ${SUPABASE_SERVICE_ROLE_KEY}
defaultSchema: public
# Alternative: direct Postgres URL (bypasses PostgREST)
# connectionString: postgresql://postgres:${PASSWORD}@db.${PROJECT_REF}.supabase.co:5432/postgres
config {
type: "rlsPolicy",
table: "orders",
name: "users_see_own_orders",
command: "select",
roles: ["authenticated"],
using: "user_id = auth.uid()",
withCheck: "user_id = auth.uid()"
}

Compiles to:

CREATE POLICY users_see_own_orders ON orders
FOR SELECT TO authenticated
USING (user_id = auth.uid())
WITH CHECK (user_id = auth.uid());

Realtime publications (realtimePublication)

Section titled “Realtime publications (realtimePublication)”
config {
type: "realtimePublication",
table: "orders",
events: ["insert", "update", "delete"]
}

Compiles to ALTER PUBLICATION supabase_realtime ADD TABLE orders;

config {
type: "table",
supabase: {
vectors: [
{
column: "embedding",
dimensions: 1536,
indexType: "hnsw",
params: { m: "16", ef_construction: "64" }
}
]
}
}
SELECT ...

Foreign tables via Supabase Wrappers (wrapper)

Section titled “Foreign tables via Supabase Wrappers (wrapper)”

Read BigQuery data directly in Supabase via FDW:

config {
type: "wrapper",
wrapper: "bigquery",
server: "bq_analytics",
options: {
project: "my-bq-project",
dataset: "models",
table: "churn_predictions"
}
}

See also: Hybrid Warehouses — Supabase + BigQuery for architectural patterns.