
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 build and run Dataflow pipelines (Python) to do the following:
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.
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.
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:
You can use Gemini Code Assist in an integrated development environment (IDE) such as Cloud Shell to receive guidance on code or solve problems with your code. Before you can start using Gemini Code Assist, however, you need to enable it.
In the Cloud Shell Editor, navigate to Cloud Code > Help and Feedback > Change Settings.
In the Settings, search for Gemini Code Assist.
Locate and ensure that the checkbox is selected for Geminicodeassist: Enable, and close the Settings.
Click Cloud Code - No Project in the status bar at the bottom of the screen.
Authorize the plugin as instructed. If a project is not automatically selected, click Select a Google Cloud Project, and choose
Verify that your Google Cloud project (
In this section, prompt Gemini Code Assist for more information on the data ingestion pipeline to provide an overview for a new team member.
In the Cloud Shell Editor's file Explorer, navigate to dataflow_python_examples > dataflow_python_examples > data_ingestion.py.
Open the data_ingestion.py
file. This action enables Gemini Code Assist, as indicated by the presence of the icon in the upper-right corner of the editor.
Click the Gemini Code Assist: Smart Actions icon and select Explain this.
Gemini Code Assist opens a chat pane with the prefilled prompt of Explain this
. In the inline text box of the Code Assist chat, replace the prefilled prompt with the following, and click Send:
This code populates a BigQuery table with the data files from Cloud Storage. The detailed explanation for the code in the data_ingestion.py
file appears in the Gemini Code Assist chat.
In this section, you return to your Cloud Shell session to set up the required Python libraries.
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:
In this section, you prompt Gemini Code Assist for additional information on the data transformation pipeline to assist the new team member further.
In the Cloud Shell menu bar, click Open Editor.
In the Cloud Shell Editor, still in the same directory, navigate to data_transformation.py
file. As before, notice the icon in the upper-right corner of the editor.
Click the Gemini Code Assist: Smart Actions icon and select Explain this.
Gemini Code Assist opens a chat pane with the prefilled prompt of Explain this
. In the inline text box of the Code Assist chat, replace the prefilled prompt with the following, and click Send:
The explanation for the code in the data_transformation.py
file appears in the Gemini Code Assist chat.
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 this section, you leverage the AI-powered features of Gemini Code Assist to review and edit the Python code for the data enrichment pipeline.
In the Cloud Shell menu bar, click Open Editor.
In the Cloud Shell Editor, still in the same directory, navigate to data_enrichment.py
. As before, notice the icon in the upper-right corner of the editor.
Click the Gemini Code Assist: Smart Actions icon on the toolbar.
To update the code at Line 83, paste the following prompt into the Gemini Code Assist inline text field that opens from the toolbar.
To prompt Gemini Code Assist to modify the code accordingly, press ENTER.
When prompted in the Gemini Diff view, click Accept.
The updated line 83 in the data_enrichment.py
file now looks something like this:
This Dataflow pipeline takes approximately five minutes to start, complete the work, and then shut down.
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 with input from Gemini Code Assist to ingest data from Cloud Storage into BigQuery and then transform and enrich the data in BigQuery.
Looking for more? Check out the 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 September 1, 2025
Lab Last Tested September 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