简体   繁体   中英

Query from a just-expired view in BQ

Is it possible to query from a recently expired view in Big Query and save a snapshot? (expired 2h ago)

You can try Managing tables

In the documentation there is some examples on how to do that in section Restoring deleted tables .

You can undelete a table within seven days of deletion, including explicit deletions and implicit deletions due to table expiration. After seven days, it is not possible to undelete a table using any method, including opening a support ticket.

You can restore a deleted table by:

  • Using the @ snapshot decorator in the bq command-line tool
  • Using the client libraries

To restore a table, use a table copy operation with the @ snapshot decorator. First, determine a UNIX timestamp of when the table existed (in milliseconds). Then, use the bq copy command with the snapshot decorator.

For example, enter the following command to copy mydataset.mytable at the time 1418864998000 into a new table mydataset.newtable.

bq cp mydataset.mytable@1418864998000 mydataset.newtable
(Optional) Supply the --location flag and set the value to your location.

You can also specify a relative offset. The following example copies the version of a table from one hour ago:

bq cp mydataset.mytable@-3600000 mydataset.newtable

For more information, see Restore a table from a point in time .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM