Recover BigQuery dataset and all tables within it

Problem

A BigQuery user has deleted a dataset and all tables within it.

Environment

  • BigQuery

Solution

  • Tables from a deleted dataset cannot be recovered.

Cause

The dataset is not soft-deleted, it is immediately removed and its metadata is permanently gone. Thus the directory of tables that existed in this dataset is not available. Therefore attempts to recover a table after recreating the dataset will fail. This is briefly documented in the Deleting a dataset section.

This is in contrast to recovering deleted tables where only tables have been deleted, and not the dataset itself. In this scenario there are supported procedures which can be used to undelete the table or recover data using time-travel querying capabilities if the table still exists.