0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

BigQueryで削除済みのテーブルを復元する方法

Posted at

本記事の内容

BigQueryで削除してしまったテーブルを復元する方法を共有して、BigQuery初学者の方の助けになればと思い作成しました。

復元するためのコード(CLIで叩いてください)

$ bq cp <復元したいテーブルがあったdataset_id>.<復元したいtable_id>@<unixエポック時刻の経過時間(ミリ秒単位)> <コピー先のdataset_id>.<コピー先のtable_id(新しく作成してOK)>

具体例

$ bq cp banana_dataset.yellow_table@1669079136904 apple_dataset.yellow_table_restored

unixエポック時刻の経過時間の出し方(bigqueryコンソールで叩いてください)

select unix_millis(timestamp_expression)

現在時刻のunixエポック時刻の経過時間の出し方

select unix_millis(current_timestamp())

削除済みのテーブルを復元する際の注意事項

BigQuery では、タイムトラベルを使用して、BigQuery で変更または削除されたデータにアクセスできます。デフォルトでは、過去 7 日間のタイムトラベル期間内であれば、どの時点のデータにもアクセスできます。
https://cloud.google.com/bigquery/docs/time-travel?hl=ja#restore-a-table

参考記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?