Materialize Documentation
s
Join the Community github/materialize

How to connect GCP Cloud SQL to Materialize

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:

  1. In the Google Cloud Console, set the cloudsql.logical_decoding to on. This enables logical replication.

  2. 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.

  3. Restart the database to apply your changes.

  4. 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;
    

    The mz_source publication 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.