How to migrate from Supabase to Databricks Lakebase
Summary
- Both are PostgreSQL databases. Supabase and Lakebase both run PostgreSQL, so schema and data migration use standard Postgres tools (pg_dump/pg_restore) with no data type conversion required. See the Lakebase documentation.
- Migrate schema and data with pg_dump and pg_restore. Export your schema, stored procedures, and constraints from Supabase using pg_dump; import into a new Lakebase database using pg_restore. The process preserves table definitions, indexes, and relationships. Then verify and test data integrity.
- RLS policies migrate directly. Both Supabase and Lakebase use standard PostgreSQL Row-Level Security (RLS) policies for access control. Your existing RLS rules will work unchanged in Lakebase, though authentication will shift from Supabase API keys to Databricks workspace identity or service principals.
- Reconnect your app via the Lakebase Data API or a Postgres client. After migration, update your application to connect to Lakebase instead of Supabase — either directly via the PostgreSQL protocol or through the Lakebase Data API (SQL over HTTP). If using Databricks Apps, Databricks automatically provisions credentials and injects connection details.
- Gain governed analytics. Lakebase integrates with Databricks' lakehouse platform: register your Postgres database in Unity Catalog for governed discovery and cross-source queries with Delta tables, and optionally use synced tables to serve enriched lakehouse data back into your application. See Sync data to Lakebase.
How to migrate from Supabase to Databricks Lakebase
If you are running an application on Supabase and want to move to Databricks, Lakebase offers a managed PostgreSQL database with native integration into the Databricks Data Intelligence Platform. Because both Supabase and Lakebase run PostgreSQL, your schema, data, and security policies can migrate directly. After migration, you can reconnect your application and optionally add governed analytics, synced data, and lineage tracking through Unity Catalog.
Migrating schema and data
Step 1: Export from Supabase using pg_dump
Use the standard PostgreSQL pg_dump utility to export your Supabase database:
pg_dump --host=<supabase-host> \
--username=<supabase-user> \
--dbname=<supabase-db> \
--schema=public \
--file=backup.sql
This export captures schemas, table definitions, constraints, indexes, sequences, and other objects. If you have stored procedures or custom types, include --schema=* to capture all non-system schemas.
Step 2: Import into Lakebase using pg_restore
Once you have created a new Lakebase database instance, restore your backup:
psql --host=<lakebase-host> \
--username=<lakebase-user> \
--dbname=<lakebase-db> \
< backup.sql
Because both databases are PostgreSQL, data types, constraints, and relationships will transfer without conversion.
Step 3: Validate and test
After restore completes:
- Verify row counts and sample data integrity against the original Supabase database.
- Test queries that exercise joins, aggregations, and functions.
- Check that indexes were created and are accessible.
- Run a performance baseline to compare query latency and throughput.
Migrating authentication and security policies
Row-Level Security (RLS) policies
Both Supabase and Lakebase use standard PostgreSQL RLS to restrict row visibility based on conditions. Your Supabase RLS policies will work unchanged in Lakebase. For example:
CREATE POLICY user_isolation ON users
USING (id = current_user_id());
This policy enforces that users see only their own rows and will migrate directly into Lakebase without modification.
Authentication and credentials
Supabase typically provides API keys or PostgreSQL passwords for application authentication. When you move to Lakebase:
- Direct Postgres connections: Update your application's connection string to point to your Lakebase host, port, and credentials. Store credentials securely in environment variables or a secrets manager.
- Databricks Apps: If you are building a Databricks App (Python, Node.js, R), register Lakebase as a resource. Databricks automatically creates a service principal for your app, assigns it a matching PostgreSQL role, and injects connection details as environment variables — so your application connects without hardcoding credentials. See Connect a Databricks App to Lakebase.
Reconnecting your application
After migration, your application needs to connect to Lakebase instead of Supabase. You have two options:
Option 1: Direct PostgreSQL connection
Update your connection string to use your Lakebase database host and credentials. For example, in a Node.js app:
const { Client } = require('pg');
const client = new Client({
host: process.env.LAKEBASE_HOST,
port: 5432,
database: process.env.LAKEBASE_DB,
user: process.env.LAKEBASE_USER,
password: process.env.LAKEBASE_PASSWORD,
});
await client.connect();
Option 2: Lakebase Data API (SQL over HTTP)
If your application prefers REST queries, use the Lakebase Data API to send SQL statements directly without maintaining a persistent connection. See the Lakebase documentation for API details and authentication.
Adding governed analytics and data enrichment
Once your application is running on Lakebase, you can optionally add capabilities that Supabase does not offer:
Register Lakebase in Unity Catalog
Register your Lakebase database in Databricks' unified governance layer to make schemas and tables discoverable, track lineage, and enforce access policies across your organization. See Register a Lakebase database in Unity Catalog.
Synced tables: Serve enriched lakehouse data
If you have a Databricks lakehouse with gold tables, engineered features, or ML model outputs, use synced tables to keep a read-only copy of that data in Lakebase. Your application then queries fresh, enriched data with transactional guarantees in Snapshot, Triggered, or Continuous sync modes. See Sync data to Lakebase.
Cross-source queries and lineage
Once registered in Unity Catalog, you can join your Lakebase operational tables with Delta tables in your lakehouse in a single query, combining transactional and analytical data. Unity Catalog tracks lineage across both layers, so you have complete visibility into how data flows from operational apps to analytics.
Getting started
- Set up a Lakebase instance. Start with the Lakebase documentation to create your first database instance.
- Export and restore your schema and data. Use pg_dump and pg_restore as described above to copy your application database.
- Migrate RLS policies and credentials. Update your authentication and test that RLS policies work as expected.
- Test and deploy your application. Validate that your application connects and queries work correctly, then update production credentials.
- Optional: Set up governance and synced data. Register your database in Unity Catalog and explore synced tables to serve enriched analytical data back to your operational application.
FAQs
Can I migrate my schema directly, or do I need to rewrite DDL?
No rewriting is necessary. Because both Supabase and Lakebase use PostgreSQL, pg_dump exports your entire schema exactly as it is. Simply restore it into Lakebase using pg_restore or the psql client.
Will my RLS policies work in Lakebase?
Yes. Lakebase uses standard PostgreSQL RLS, so your existing policies will migrate and work unchanged. Test them after migration to ensure behavior is as expected.
How do I change my application's connection credentials?
Update your application to point to your Lakebase host, port, database name, and credentials. Store credentials securely in environment variables or a secrets manager. If using a Databricks App, Databricks automatically provisions and injects credentials.
What is the Lakebase Data API?
The Lakebase Data API is an SQL-over-HTTP interface that lets your application send SQL queries without maintaining a persistent PostgreSQL connection. Use it if your application prefers REST APIs over traditional database clients. See the Lakebase documentation for details.
Can I replicate my data continuously from Supabase into Lakebase?
Yes, but you will use Lakebase's managed tools. Lakebase does not directly replicate from Supabase; instead, after migration, you can use synced tables to keep Databricks lakehouse data in sync with Lakebase Postgres. Alternatively, use a third-party CDC (Change Data Capture) tool like Fivetran or Airbyte to replicate ongoing changes from Supabase into a Databricks lakehouse or Lakebase (consult your provider's Lakebase support).
What do I gain by moving to Lakebase?
Lakebase is integrated into the Databricks Data Intelligence Platform. You gain governed discovery (Unity Catalog), synced data (serve lakehouse enrichments into your app), lineage tracking, and the ability to query across operational and analytical data in one system. Your application also inherits platform capabilities like PrivateLink, IP ACLs, and integrated monitoring.
Do I need to re-architect my application?
No. Your application can continue to use standard PostgreSQL clients and queries. The main changes are updating the connection string and credentials. If you want to use advanced Databricks features like Databricks Apps or synced tables, you can adopt them incrementally.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.