Supabase is an open-source Firebase alternative built around Postgres.
It inherits all the advantages of Postgres, such as scalability and extensibility,
but just like other OLTP databases, its main use scenarios may not cover all of your needs.
With DoubleCloud, you can replicate your data in real time from Supabase to ClickHouse
— a database designed for analytics.
This will enable you to run analytical queries faster, use less storage, and save costs,
while still benefiting from using an OLTP database
This tutorial guides you through replicating data from Supabase to ClickHouse®
with DoubleCloud Transfer — a real-time data replication tool.
You will learn how to create a ClickHouse® cluster, set up a data pipeline, apply data transformations, and run queries.
Open your project in Supabase, click Project settings in the left menu and select Database
Under Database settings, copy the URI connection string.
You will need this string when configuring the source endpoint later in this tutorial.
Step 3. Create a Managed ClickHouse® cluster
Go to the Clusters page
in the DoubleCloud console.
Click Create cluster at the top right and select ClickHouse.
Tip
For this tutorial, you don’t need to modify cluster settings on this page.
If you proceed with the default settings,
you get a fully functional ClickHouse® cluster that you can use for testing and development.
Under Basic settings, enter a cluster name, such as clickhouse-dev.
Click Submit.
Creating a cluster takes around five minutes depending on the provider, region, and settings.
Step 3. Create a ClickHouse® database
After the cluster status changes from Creating to Alive, select it in the cluster list.
Click WebSQL at the top right.
In WebSQL, click on any database in the connection manager on the left to open the query editor.
Create a new database named listings using the following command:
CREATE DATABASE IF NOT EXISTS countries ON CLUSTER default;
Check that the database has been created:
SHOW DATABASES
┌─name───────────────┐
│ INFORMATION_SCHEMA │
│ _system │
│ default │
│ countries │ // your database
│ information_schema │
│ system │
└────────────────────┘
Step 4. Create a source PostgreSQL endpoint
Because Supabase is essentially a Postgres database,
you can connect to it by configuring a source PostgreSQL endpoint.
To create a source endpoint:
Go to the Transfer page in the console
and click Create → Source endpoint at the top right.
In Source type, select PostgreSQL.
Enter an endpoint name, such as supabase-source-dev.
In connection type select SRV.
Under Endpoint parameters, fill out connection details for your Supabase database.
You can get the connection details from the connection string that you copied earlier.
This string has the following format: