From the course: Data Science on Google Cloud Platform: Exploratory Data Analytics

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Writing data to BigQuery

Writing data to BigQuery - Google Cloud Tutorial

From the course: Data Science on Google Cloud Platform: Exploratory Data Analytics

Start my 1-month free trial

Writing data to BigQuery

- [Instructor] After you perform all your exploratory analytics, you might want to persist intermediate or final results back to BigQuery for later use. Let's look at how we can save a data frame back to BigQuery. We will continue to use the cust_df data frame for this example. First, we extract the schema for the new table from the data frame schema. This is done by using the function from data and passing the cust_df as the parameter. This is stored in the schema variable. Then we create a new table using the bq.Table command. The table name is Type1Customers under the data set EDA. The create function creates a table. We pass the schema for the table based on what we just created before. We say overwrite is true, so the table will be overwritten if it already existed. We then insert data into the table by using cust table.insert, and passing the data frame as the reference. We can then go to the BigQuery console now, and the newly created table should show. If you do not see the…

Contents