Skip to main content
Streaming Query Replication (QRep) is a deprecated mirror type and no longer actively maintained. It remains fully functional and no code is currently being removed. We recommend CDC (Change Data Capture) as the actively-maintained mirror type for new mirrors. BigQuery as a destination is also deprecated, though BigQuery remains a supported source.

Scenario

Let’s consider a scenario where we have an events table in PostgreSQL. We want to periodically sync data from this table in PostgreSQL to BigQuery. However, we only want to sync a few columns filtered based on the country (USA) and create a single denormalized view of the data in BigQuery. Let’s see how we can achieve this within a few minutes and a few SQL commands using PeerDB.

Step 1: Add PostgreSQL and BigQuery Peers

Run the following commands to add the PostgreSQL and BigQuery Peers to PeerDB:
Make sure to replace (…) with the appropriate connection details for both the PostgreSQL and BigQuery instances. More details on adding peers are available here.

Step 2: Set up MIRROR to Transform and Sync Data

With the peers set up, you can create a mirror that facilitates periodic sync from PostgreSQL to BigQuery with custom transformations.

Step 3: Validate the Mirror

Using the same PostgreSQL-compatible SQL interface of PeerDB, you can quickly validate the MIRROR.

Step 4: Monitor the MIRROR

You can connect to localhost:8085 to gain full visibility into the different jobs and steps that PeerDB performs under the hood to manage the MIRROR. Managing Mirror

Step 5: DROP MIRROR

To make it easy in your development and test environments, PeerDB also introduces the DROP MIRROR command. DROP MIRROR drops all the underlying objects that CREATE MIRROR generates. More details are available in this PR.

Support

If you run into any issues, join our slack channel and reach out to us. You can file an issue on our github repository or reach out to founders@peerdb.io . We will follow up!