This lab walks you through Cloud BigQuery.
You will be creating a BigQuery Dataset and loading the CSV data.
Duration: 60 minutes
BigQuery is a fully managed big data tool for companies who need a cloud-based interactive query service for massive datasets.
BigQuery is not a database, it's a query service.
BigQuery supports SQL queries, which makes it quite user-friendly. It can be accessed from Console, CLI, or using SDK. You can query billions of rows, it only takes seconds to write, and seconds to return.
You can use its REST APIs and get your work done by sending a JSON request.
Let’s understand with help of an example, Suppose you are a data analyst and you need to analyze tons of data. If you choose a tool like traditional MySQL, you need to have an infrastructure ready, that can store this huge data.
You can focus on analysis rather than working on infrastructure. Hardware is completely abstracted.
Designing this infrastructure itself will be a difficult task because you will have to figure out RAM size, CPU type, or any other configurations.
BigQuery is mainly for Big Data. You shouldn’t confuse it with OLTP (Online Transaction Processing) database.
Datasets: Datasets hold one or more tables of data.
Tables: Tables are row-column structures that hold actual data
Jobs: Operations that you perform on the data, such as loading data, running queries, or exporting data.
Login into GCP Console.
Creating a BigQuery Dataset.
Create a Table.
Loading the data through an external CSV.
Reading data through the Table using SQL Query.
Launch the lab environment by clicking on . This will create a GCP environment with the resources and roles required for this lab.
Once the lab environment is ready, will be active. Click on , this will open Google Sign-In page. (Make sure you are using an Incognito mode).
On your previous tab, Click on and copy your credentials to Sign-in to the console.
Once logged in, you will be redirected to the GCP Console.
Click on the hamburger icon on the top left corner
Click on BigQuery under the BigData section.
Find the project id listed in the sidebar. Click on the Kebab menu in the corner then click on Open
Click on Create Dataset on the top bar.
Enter dataset id as whizlabs_bq_dataset. if you enter anything else then it won't validate the lab.
Choose the Data location as United States(US).
Keep the given options as is.
Click on Create Dataset.
Click on the right arrow in the sidebar to expand the project.
You will be able to see the dataset. Click on the Kebab menu in the corner then click on Open.
You can see + Icon to create a table and upload the data.
Choose the option as Upload in Source.
Click on Browse to choose the file from the local system. Click here to download the file which you can choose to upload.
Enter the table name as user_details. Do not choose any other name. It is required for the validation of the lab.
Keep the given options as is.
Click on the Check box to auto-detect the schema.
Click on Create table.
Click on the right arrow to expand the dataset.
You will be able to see the table which you created.
You can see the schema as shown.
Click on Compose new query.
Modify and enter the below query to fetch the data from the table, change your project id.
Click on Run to trigger the query.
You can see the output in the Query results section.
In this lab, you have created a BigQuery Dataset.
You have created a Table and loaded data through an external CSV.
You have read the data from the table using SQL Query.
You have successfully completed the lab.
Once you have completed the steps click on from your whizlabs dashboard.