Recover truncated table in BigQuery

ROBIN DONG 2021-06-03 14:39

If you accidentally truncate a table in BigQuery, you can trythis articleto recover the data. Furthermore, I found out that the"bq cp project:dataset.table@-36000 project:dataset.table ” method could not work in my situation. The only working solution is “SYSTEM_TIME AS OF “:

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

and then “bq cp project:mydataset.newtable project:mydataset.mytable

[返回] [原文链接]