CLOUD-DATABASE-ENGINEER practice question 10 of 25

Your company is using Cloud SQL for MySQL with an internal (private) IP address and wants to replicate some tables into BigQuery in near-real time for analytics and machine learning. You need to ensure that replication is fast and reliable and uses Google-managed services. What should you do?

Full set: 141 questions
Answer options
A: Develop a custom data replication service to send data into BigQuery.
B: Use Cloud SQL federated queries.
C: Use Database Migration Service to replicate tables into BigQuery.
D: Use Datastream to capture changes, and use Dataflow to write those changes to BigQuery. Correct answer
Correct Answer:
D. Use Datastream to capture changes, and use Dataflow to write those changes to BigQuery.
Explanation

This solution uses two fully-managed Google Cloud services to create a robust, near-real time replication pipeline. Datastream is a serverless Change Data Capture (CDC) service that can connect to the private IP Cloud SQL for MySQL instance and stream data changes to Cloud Storage. A pre-built Dataflow template can then read this change stream from Cloud Storage and efficiently write the updates to the specified BigQuery tables. This architecture is designed for low-latency, reliable data replication and is the recommended Google-managed pattern for this specific use case.

Why Incorrect

A. Developing a custom service contradicts the requirement to use Google-managed services and introduces unnecessary operational overhead and complexity.
B. Cloud SQL federated queries allow BigQuery to query data directly in Cloud SQL but do not replicate or move the data into BigQuery, which is a key requirement for analytics and ML performance.
C. Database Migration Service (DMS) is designed for migrating and replicating databases to other managed relational databases like Cloud SQL, AlloyDB, or Cloud Spanner, not to a data warehouse like BigQuery.

References

1. Datastream and Dataflow for BigQuery Replication: Google Cloud Documentation, "Replicate data to BigQuery". This page explicitly describes the recommended pattern: "Datastream uses the BigQuery Change Data Capture (CDC) functionality and Dataflow to replicate data and schema updates from a source database directly into BigQuery."

2. Datastream Overview: Google Cloud Documentation, "Datastream overview". This document identifies Datastream as Google's "serverless change data capture (CDC) and replication service" and lists BigQuery as a primary destination, reinforcing its suitability for this task.

3. Cloud SQL Federated Queries: Google Cloud Documentation, "Query Cloud SQL data". The documentation states, "BigQuery Cloud SQL federation enables BigQuery to query data residing in Cloud SQL in real time, without copying or moving data." This confirms it is for querying, not replication.

4. Database Migration Service Overview: Google Cloud Documentation, "Database Migration Service overview". The "Supported source and destination databases" section lists the valid destinations for DMS, which include Cloud SQL, AlloyDB, and Cloud Spanner, but not BigQuery.

Scroll to Top