Delete table snapshots

This document describes how to delete a table snapshot by using the Google Cloud Console, a DROP SNAPSHOT TABLE Standard SQL statement, a bq rm command, or a BigQuery API tables.delete call. It also provides information about how to recover a table snapshot that was deleted or that expired in the past seven days. It is intended for users who are familiar with table snapshots.

Permissions and roles

This section describes the Identity and Access Management (IAM) permission that you need to delete a table snapshot, and the predefined IAM roles that grant those permissions.

Permissions

To delete a table snapshot, you need the following permission:

Permission Resource
bigquery.tables.deleteSnapshot The table snapshot that you want to delete

Roles

The predefined BigQuery roles that provide the required permissions are as follows:

Role Resource
Any of the following:

bigquery.dataOwner
bigquery.admin
The table snapshot that you want to delete.

Delete a table snapshot

Delete a table snapshot as you would delete a standard table. You don't need to delete a table snapshot that has expired.

For example, delete the library_backup.books table snapshot as follows:

Console

  1. In the Cloud Console, go to the BigQuery page.

    Go to BigQuery

  2. In the Explorer pane, expand the project and dataset nodes of the library_backup.books table snapshot.

  3. Click the table snapshot that you want to delete, in this case, books.

  4. In the table snapshot pane that appears, click Delete.

  5. Confirm, and then click Delete again.

SQL

Run the following query:

DROP SNAPSHOT TABLE
  library_backup.books

bq

Enter the following command in the Cloud Shell:

Go to Cloud Shell

bq rm library_backup.books

API

Call the tables.delete method with the following parameters:

Parameter Value
projectId myProject
datasetId library_backup
tableId books

Restore a deleted or expired table snapshot

You can recover a table snapshot that was deleted or that expired in the past seven days in the same way that you recover a standard table. For more information, see Restoring deleted tables.

What's next