
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Disable and re-enable the Dataflow API
/ 10
Create a Cloud Storage Bucket
/ 10
Copy Files to Your Bucket
/ 10
Create the BigQuery Dataset (name: lake)
/ 20
Build a Data Ingestion Dataflow Pipeline
/ 10
Build a Data Transformation Dataflow Pipeline
/ 10
Build a Data Enrichment Dataflow Pipeline
/ 10
Build a Data lake to Mart Dataflow Pipeline
/ 20
Dataflow is a Google Cloud service that provides unified stream and batch data processing at scale. It is built on the Apache Beam project, which is an open source model for defining both batch and streaming data-parallel processing pipelines. Using one of the open source Apache Beam SDKs, you can build a program that defines the pipeline and then use Dataflow to execute the pipeline.
In this lab, you use the Apache Beam SDK for Python to build and run a pipeline in Dataflow to ingest data from Cloud Storage to BigQuery, and then transform and enrich the data in BigQuery.
In this lab, you learn how to:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
To ensure access to the necessary API, restart the connection to the Dataflow API.
In the Google Cloud console title bar, type Dataflow API in the Search field and then click Dataflow API from the search results.
Click Manage.
Click Disable API.
If asked to confirm, click Disable.
When the API has been re-enabled, the page shows the Disable option.
Click Check my progress to verify your performed task.
Download the Dataflow Python examples to use in this lab.
In Cloud Shell, create a Cloud Storage bucket, and then copy files to the bucket. These files are the Dataflow Python examples.
Click Check my progress to verify your performed task.
gsutil
command to copy files into the Cloud Storage bucket you just created:Click Check my progress to verify your performed task.
Create a dataset in BigQuery dataset. This is where your tables are loaded in BigQuery.
In Cloud Shell, create the dataset named lake
:
Click Check my progress to verify your performed task.
In this task, you review the pipeline code to see how it works. You then set up and run the pipeline.
The data ingestion pipeline ingests data from Cloud Storage into the BigQuery table using a TextIO source and a BigQueryIO destination. Specifically, the pipeline:
Use the Cloud Shell Code Editor to review the pipeline code.
In the Cloud Shell menu bar, click Open Editor.
Navigate to dataflow_python_examples
> dataflow_python_examples
, and open the data_ingestion.py
file.
Read the comments in the file, which explain what the code is doing.
This code populates a BigQuery table with the data files from Cloud Storage.
The Dataflow jobs in this lab require Python3.8
. To ensure you're on the proper version, run the Dataflow processes in a Python 3.8 Docker container.
This command pulls a Docker container with the latest stable version of Python 3.8 and executes a command shell to run the next commands within the container. The -v
flag provides the source code as a volume
for the container so that we can edit in Cloud Shell editor and still access it within the running container.
apache-beam
in that running container:This code spins up the workers required and then shut them down when the pipeline is complete.
When the Dataflow page opens, view the status of your job.
Once your Job Status is Succeeded, you can move to the next step. This ingestion pipeline takes approximately five minutes to start, complete the work, and then shutdown.
Navigate to BigQuery (Navigation menu > BigQuery) to see that your data has been populated.
Click your project name to see the usa_names table under the lake
dataset.
usa_names
data.usa_names
table, try refreshing the page or view the tables using the classic BigQuery UI.
Click Check my progress to verify your performed task.
In this task, you review the data transformation pipeline to learn how it works. You then run the pipeline to process the Cloud Storage files and output the result to BigQuery.
The data transformation pipeline also ingests data from Cloud Storage into the BigQuery table using a TextIO source and a BigQueryIO destination, but with additional data transformations. Specifically, the pipeline:
data_transformation.py
.Read the comments in the file, which explain what the code is doing.
In the Google Cloud console title bar, type Dataflow in the Search field and then click Dataflow from the search results.
Click the name of this job to view the status of your job.
This Dataflow pipeline takes approximately five minutes to start, complete the work, and then shutdown.
You should see the usa_names_transformed table under the lake
dataset.
usa_names_transformed
data.usa_names_transformed
table, try refreshing the page or view the tables using the classic BigQuery UI.
Click Check my progress to verify your performed task.
You now build a data enrichment pipeline that accomplishes the following:
In the Code Editor, open data_enrichment.py
.
Check out the comments, which explain what the code is doing. This code populates the data in BigQuery.
Line 83 currently looks like:
This Dataflow pipeline takes approximately five minutes to start, complete the work, and then shutdown.
You should see the usa_names_enriched table under the lake
dataset.
usa_names_enriched
data.usa_names_enriched
table, try refreshing the page or view the tables using the classic BigQuery UI.
Click Check my progress to verify your performed task.
Now you build a Dataflow pipeline that reads data from two BigQuery data sources and then joins the data sources. Specifically, you:
You first review the data_lake_to_mart.py
code to gain understanding of what it does. You then run the pipeline in the cloud.
data_lake_to_mart.py
file.Read the comments in the file, which explain what the code is doing. This code joins two tables and write the results to new table in BigQuery.
In the Google Cloud console title bar, type Dataflow in the Search field, and then click Dataflow from the search results.
Click this new job to view the status.
This Dataflow pipeline takes approximately five minutes to start, complete the work, and then shutdown.
You should see the orders_denormalized_sideinput table under the lake
dataset.
orders_denormalized_sideinput
data.orders_denormalized_sideinput
table, try refreshing the page or view the tables using the classic BigQuery UI.
Click Check my progress to verify your performed task.
Below is a multiple choice question to reinforce your understanding of this lab's concepts. Answer it to the best of your ability.
You executed Python code using Dataflow to ingest data from Cloud Storage into BigQuery and then transform and enrich the data in BigQuery.
Looking for more? Check out official documentation on:
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated April 1, 2025
Lab Last Tested April 1, 2025
Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one