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

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

问题描述

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

解决方案

是的.您可以使用 Table Decorators 恢复数据 - 特别是 Snapshot Decorator

您应该在覆盖表之前确定 <time>,然后使用您选择的目标表运行以下查询

SELECT * FROM YourTable@

请注意:这将花费您查询该表
从技术上讲,您可以通过使用 COPY 而不是 Query 来避免该成本.所以你可以复制YourTable@.复制是免费的

bq cp YourTable@

查看有关复制现有表的更多信息><块引用>

跟进 S.Mohsen sh 的评论:

如果您只是使用 overwrite table 写入首选项简单地覆盖表,则上述方法将起作用.但是,如果您实际上删除了表并创建了另一个具有相同名称的表 - 我认为上述方法行不通 - 您可以尝试一下!

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天全站免登陆