Recover truncated table in BigQuery
source link: http://www.donghao.org/2021/06/03/recover-truncated-table-in-bigquery/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Recover truncated table in BigQuery
If you accidentally truncate a table in BigQuery, you can try this article to 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);
xxxxxxxxxx
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“
Like this:
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK