GCP Cloud SQL (PostgreSQL)
To connect GCP Cloud SQL to Materialize via the direct Postgres Source, as a user with the
cloudsqlsuperuser role, make these changes to the upstream database:
In the Google Cloud Console, set the
on. This enables logical replication.
The Materialize instance will need access to connect to the upstream database. This is usually controlled by IP address. If you are hosting your own installation of Materialize, in your Google Cloud Console, enable access on the upstream database for the Materialize replica’s IP address.
Restart the database to apply your changes.
Create a publication with the tables you want to replicate:
For specific tables:
CREATE PUBLICATION mz_source FOR TABLE table1, table2;
For all tables in Postgres:
CREATE PUBLICATION mz_source FOR ALL TABLES;
mz_sourcepublication will contain the set of change events generated from the specified tables, and will later be used to ingest the replication stream.
For more information, see the Cloud SQL documentation.