I mistakenly deleted some important rows in a table from an uploaded dataset on BigQuery google platform, how can i restore the table?

Viewed 134
DELETE
FROM cars.car_info
WHERE price = 0;

Here's the query I ran.

1 Answers

BigQuery lets you use time travel to access data stored in BigQuery that has been changed or deleted. You can access the data from any point within the last seven days. You can use time travel to query data that was updated or deleted, restore a table that was deleted, or restore a table that expired.

Sample query:

SELECT *
FROM `mydataset.mytable`
  FOR SYSTEM_TIME AS OF TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR);

You need to select the table and write the query destination to a backup table for inspection.

More here: https://cloud.google.com/bigquery/docs/time-travel

Related