ddof
ddof

Reputation: 61

How to recover a deleted dataset in BigQuery

Is there a way to recover a deleted BigQuery dataset with all the tables?

I understand that there is a recovery procedure for the tables, but what about the datasets?

Upvotes: 6

Views: 5998

Answers (3)

user3243989
user3243989

Reputation: 101

You can restore a dataset after it has been deleted if you take action within the time travel window for your org.

Upvotes: 0

Cloudkollektiv
Cloudkollektiv

Reputation: 14699

To recover a lost dataset, you have to schedule backups which can then be restored later in case of a failure. To make a backup use the bq extract command. An example:

bq extract \
  --destination_format=AVRO \
  --use_avro_logical_types \
  --compression=SNAPPY \
  "my-project:my-dataset.my-table" \
  "gs://my-bucket/extract.avro"

To restore a lost dataset use the following command:

bq load \
  --source_format=AVRO \
  "my-project:my-dataset.my-table" \
  "gs://bucket/extract.avro"

Upvotes: 0

Jordan Tigani
Jordan Tigani

Reputation: 26617

There is no recovery mechanism for datasets, which is why we make it difficult to delete datasets that have tables in them.

Upvotes: 3

Related Questions