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
Create a Cloud SQL instance
/ 30
Whitelist the Cloud Shell instance to access your SQL instance
/ 30
Create a bts database and flights table using the create_table.sql file
/ 40
Create a Cloud SQL instance
/ 30
Whitelist the Cloud Shell instance to access your SQL instance
/ 30
Create a bts database and flights table using the create_table.sql file
/ 40
In this lab, you import data from CSV text files into Cloud SQL and then carry out some basic data analysis using simple queries.
The dataset used in this lab comes from the US Bureau of Transport Statistics and contains historical information about internal flights in the United States. This dataset can be used to demonstrate a wide range of data science concepts and techniques.
In this lab, you learn how to perform the following tasks:
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 right is the Lab setup and access panel with the following:
Note that the lab timer is located near the top of the page, showing the remaining time.
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 setup and access panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab setup and access panel.
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.
This lab uses a set of code samples and scripts developed for the Data Science on the Google Cloud Platform, 2nd Edition book from O'Reilly Media, Inc. It covers the configuration of Cloud SQL and importing data tasks described in the first part of Chapter 3, "Creating Compelling Dashboards". You copy the required sample files directly to your Cloud Shell environment to carry out the tasks.
This takes a few minutes to complete.
Click Check my progress to verify your performed task. If you have successfully created a Cloud SQL instance, you will see an assessment score.
Click Check my progress to verify your performed task. If you have successfully allowlisted Cloud Shell to access the SQL instance, you will see an assessment score.
To import data into a PostgreSQL table, you first create an empty database and a table with the correct schema.
In the Google Cloud console, on the Navigation menu (), click Cloud SQL.
In the instances list, click the instance name flights.
From the Cloud SQL navigation menu, select Databases.
Click Create database.
In the New database dialog, for Database name, type bts
Click Create.
From the Cloud SQL navigation menu, select Overview.
Click Import.
For Cloud Storage file, click Browse.
In the Buckets section, click the arrow next to your bucket name.
Select the file create_table.sql.
Click Select.
For File format, select SQL.
For Database, select bts.
Click Import to start the import.
A few seconds later, the empty table will be created.
Click Check my progress to verify your performed task. If you have successfully created a bts database and flights table using the create_table.sql file, you will see an assessment score.
Now that you have created the empty database and table, load the CSV files into this table. Load the January data by browsing to 201501.csv in your bucket and specifying CSV as the format, bts as the database, and flights as the table.
On the Overview page of your Cloud SQL instance, click Import.
For Cloud Storage file, click Browse.
In the Buckets section, click the arrow next to your bucket name.
Select the file 201501.csv.
Click Select.
For File format, select CSV.
For Database, select bts.
For Table, type flights
Click Import.
When prompted for a password, enter Passw0rd. You might not see the characters as you type.
In the prompt that opens, connect to the bts database:
When prompted for a password, enter Passw0rd.
Run the following query to view the five busiest airports:
While this query is performant because the dataset is relatively small (only January!), the database will slow as you add more months.
Relational databases are suited to smallish datasets on which you perform ad hoc queries that return a small subset of the data. For larger datasets, you tune the performance of a relational database by indexing the columns of interest. Further, because relational databases typically support transactions and guarantee strong consistency, they are an excellent choice for data that will be updated often.
However, a relational database is a poor choice if:
This describes the flight delay use case. For this case you would switch from a relational database to an analytics data warehouse – BigQuery. The analytics data warehouse allows you to use SQL and is much more capable of handling large datasets and ad hoc queries (that is, the columns do not need to be indexed).
Now you know how to create tables and import text data that has been stored on Cloud Storage into Cloud SQL.
Read more from the book this lab is based 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 October 16, 2026
Lab Last Tested August 12, 2026
Copyright 2026 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 can notify you via email when it becomes available
Great!
We can contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one