是否有可能在BigQuery中恢复被覆盖的数据 [英] Is it possible to recover overwritten data in BigQuery

查看:171
本文介绍了是否有可能在BigQuery中恢复被覆盖的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以恢复BigQuery中用 WRITE_TRUNCATE 覆盖的表中的数据?

解决方案

是。您可以使用表格修饰器恢复数据 - 特别是快照装饰器



您应该在覆盖您的表之前计算< time> ,然后在您选择的目标表下运行查询 p>

  SELECT * FROM YourTable @< time> 

请注意:这会花费您查询该表格
技术上,您可以通过使用COPY而不是Query来避免这种成本。所以你可以复制 YourTable @< time> 。复制是免费的

  bq cp YourTable @< time> < destination_table> 

详细了解复制现有表格


跟进S .Mohsen sh评论:

以上方法适用于仅使用覆盖表写入首选项。但是,如果你真的删除了表格而不是创建了另一个具有相同名称的表格 - 我不认为上述方法可行 - 但你可以试验!

Is it possible to recover data in a table overwritten with WRITE_TRUNCATE in BigQuery?

解决方案

Yes. You can recover data using Table Decorators - in particular Snapshot Decorator

you should figure out <time> right before you did overwrite your table and than run below query with destination table of your choice

SELECT * FROM YourTable@<time> 

Please note: this will cost you querying that table
Technically, you can avoid that cost by using COPY instead of Query. So yo can copy YourTable@<time>. Copying is free

bq cp YourTable@<time> <destination_table>

See more about Copy an existing table

To follow up S.Mohsen sh comments:

Above approach will work if yo just simply overwrote table using overwrite table write preference. But if you actually deleted table and than created another table with same name - I don't think above approach will work - you can experiment though!

这篇关于是否有可能在BigQuery中恢复被覆盖的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆