Send Cloud SQL Data to BigQuery


SQL (Structured Query Language) is a standard language for data operations that allows you to ask questions and get insights from structured datasets. It’s commonly used in database management and allows you to perform tasks like transaction record writing into relational databases and petabyte-scale data analysis.

This lab serves as an introduction to SQL and is intended to prepare you for the many labs and quests in Qwiklabs on data science topics. This lab is divided into two parts: in the first half, you will learn fundamental SQL querying keywords, which you will run in the BigQuery console on a public dataset that contains information on London bikeshares.

In the second half, you will learn how to export subsets of the London bikeshare dataset into CSV files, which you will then upload to Cloud SQL. From there you will learn how to use Cloud SQL to create and manage databases and tables. Towards the end, you will get hands-on practice with additional SQL keywords that manipulate and edit data.


In this lab, you will learn how to:

  • Distinguish databases from tables and projects.
  • Use the SELECT, FROM, and WHERE keywords to construct simple queries.
  • Identify the different components and hierarchies within the BigQuery console.
  • Load databases and tables into BigQuery.
  • Execute simple queries on tables.
  • Learn about the COUNT, GROUP BY, AS, and ORDER BY keywords.
  • Execute and chain the above commands to pull meaningful data from datasets.
  • Export a subset of data into a CSV file and store that file into a new Cloud Storage bucket.
  • Create a new Cloud SQL instance and load your exported CSV file as a new table.


Very Important: Before starting this lab, log out of your personal or corporate gmail account.

This is an introductory level lab. This assumes little to no prior experience with SQL. Familiarity with Cloud Storage and Cloud Shell is recommended, but not required. This lab will teach you the basics of reading and writing queries in SQL, which you will apply by using BigQuery and Cloud SQL.

Before taking this lab, consider your proficiency in SQL. Below are more challenging labs that will let you apply your knowledge to more advanced use cases:

Once you’re ready, scroll down and follow the steps below to get your lab environment set up.

Setup and Requirements

Before you click the Start Lab button

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 will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

What you need

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
  • Time to complete the lab.

Note: If you already have your own personal Google Cloud account or project, do not use it for this lab.

Note: If you are using a Chrome OS device, open an Incognito window to run this lab.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store