Stream Pub/Sub Messages into BigQuery and Query the Results
Advanced · 30 minutes · 5 tasks, checked automatically · 100 points
In this advanced lab you will build a real-time ingestion pipeline entirely inside a local GCP emulator. You will create a BigQuery dataset and table with a defined schema, set up a Pub/Sub topic and a BigQuery subscription that writes every published message directly into that table, publish a batch of JSON-encoded messages, and finally run SQL queries against BigQuery to confirm the data landed correctly. This pattern is the foundation of event-driven analytics architectures on GCP.
What you’ll learn
- Create a BigQuery dataset and a typed table that will serve as the streaming sink
- Create a Pub/Sub topic and a BigQuery subscription that auto-writes messages to the table
- Publish structured JSON messages to the topic and verify the rows appear in BigQuery via SQL
How this lab works
- Start the lab: One click starts an emulated cloud on your computer, with the cloud’s own CLI ready: no account and no bill.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work reads the emulated cloud’s resources and says, task by task, what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Runs: An emulated cloud on your computer: no cloud account, no bill
- Cloud: GCP
- Services: pubsub, bigquery
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop (or Podman / Rancher Desktop) installed and running
- A GCP sandbox created in the Local Cloud Playground
Topics: pubsub, bigquery, streaming, ingestion, sql, analytics, event-driven, gcp, emulator
Create a free account to start this lab.
Keep going
- Cosmos DB Partition Key Design and Cross-Partition Query Optimization
- Capture Changes with DynamoDB Streams and Process Them in a Lambda Consumer
- DynamoDB Batch & Transact Writes with boto3: Partial Failures and Retries
- Add a Global Secondary Index to a DynamoDB Table and Query It
- Prevent Lost Updates with DynamoDB Conditional Writes
- Datastore Ancestor Keys and Composite Index Queries