The “Children of the World” sculpture

How to empty a table in BigQuery

BigQuery is the Google Cloud Platform data warehouse solution, and setting up datasets you have many options for importing data into a BigQuery table. There are times when you just want to empty a table, to import data again.

In my use cases, I often create custom data pipelines with Google Cloud Functions this link takes you to the article How to build a RESTful API data pipeline with a Firebase Cloud Function and BigQuery

In BigQuery you can use the BigQuery Data Manipulation Language (DML) enables you to update, insert, and delete data from your BigQuery tables – https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax

Empty a table

To empty a table you could use the delete data you may not be able to delete everything you have to repeat your delete SQL statement. There is another way you could empty all data in your table, that by doing the following.

CREATE OR REPLACE TABLE `ships.noonreport.noonreport`
AS SELECT * FROM `ships.noonreport.noonreport` LIMIT 0;

If you look at the SQL statement you are basically recreating the table without any data in it. This has worked very well for me, have a go with it.


Posted

in

, , ,

by

Comments

One response to “How to empty a table in BigQuery”

  1. […] that does happen you may want to empty your BigQuery table you can do it in many ways, you can read How to empty a table in BigQuery to learn how I do […]

Leave a Reply

Your email address will not be published. Required fields are marked *