2

There are a few posts on this via the CLI, but not sure on the current state via the UI and with the new alpha UI coming.

Is there a way, within the 2 day delete grace period limit, to restore a deleted table using ONLY the BQ UI and standardSQL to query-and-save to essentially 'restore', not the GCP CLI? ie

select *
from deleted-table@timstamp

and then save the result in the UI to the original table name?

This strikes me as a much simpler way to do this given most of us spend our time in the BQ UI doing other BQ work anyway?

Thoughts?

Thanks

Kurt Maile
  • 1,171
  • 3
  • 13
  • 29
  • From the answer at https://stackoverflow.com/questions/27537720/how-can-i-undelete-a-bigquery-table, you can do the same thing with the BigQuery Web UI. – JL-HaiNan Feb 13 '18 at 23:04
  • Hi, Thanks for replying appreciated. Maybe Im missing it but in that thread, although it says 'can do in the bigquery UI', I cant see how as every command looks like a bq cli command - my key point was could it be done in SQL only executing a SQL query on the table at a previous point in time? The UI just says it cant find the table (as its deleted) even with athe @ timestamp postfixed. An example if so would be very much appreciated. Cheers! :) – Kurt Maile Feb 14 '18 at 05:28

1 Answers1

6

With standard SQL you can run SELECT * FROM deleted-table FOR SYSTEM TIME AS OF ...

which works like the @timestamp in legacy SQL. More details here https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#for-system-time-as-of

You can set destination table in the query options in UI.

Daria
  • 606
  • 3
  • 5