[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/bigquery/docs/table-snapshots-create [Back]  [Original]

Create table snapshots  |  BigQuery  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback Stay organized with collections Save and categorize content based on your preferences.

Create table snapshots

This document describes how to create a snapshot of a table by using the Google Cloud console, the CREATE SNAPSHOT TABLE SQL statement, the bq cp --snapshot command, or the jobs.insert API. This document is intended for users who are familiar with BigQuery table snapshots.

Permissions and roles

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

Permissions

To create a table snapshot, you need the following permissions:

Permission Resource Notes
All of the following:

bigquery.tables.get
bigquery.tables.getData
bigquery.tables.createSnapshot
bigquery.datasets.get
bigquery.jobs.create
The table that you want to snapshot. Because snapshot expiration deletes the snapshot at a later time, to create a snapshot with an expiration time you must have the bigquery.tables.deleteSnapshot permission.
bigquery.tables.create
bigquery.tables.updateData
The dataset that contains the table snapshot.

Roles

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

Role Resource Notes
At least one of the following:

bigquery.dataViewer
bigquery.dataEditor
bigquery.dataOwner

And at least one of the following:

bigquery.jobUser
bigquery.studioUser
bigquery.user
bigquery.studioAdmin
bigquery.admin
The table that you want to snapshot. Only bigquery.dataOwner, bigquery.admin, and bigquery.studioAdmin can be used for creating a snapshot with an expiration time.
At least one of the following:

bigquery.dataEditor
bigquery.dataOwner
bigquery.studioAdmin
bigquery.admin
The dataset that contains the new table snapshot.

Limitations

For information about table snapshot limitations, see table snapshot limitations.

In addition, table snapshot creation is subject to the following limitations, which apply to all table copy jobs:

Create a table snapshot

Best practice is to create a table snapshot in a different dataset from the base table. This practice allows the base table to be restored from its table snapshot even if the base table's dataset is accidentally deleted.

When you create a table snapshot, you specify the table you want to snapshot and a unique name for the table snapshot. You can optionally specify the time of the snapshot and the table snapshot's expiration.

Create a table snapshot with an expiration

You can create a snapshot of a table that expires after 24 hours by using one of the following options:

Console

  1. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  2. In the left pane, click Explorer:

    Highlighted button for the Explorer pane. [Highlighted button for the Explorer pane.]

    If you don't see the left pane, click Expand left pane to open the pane.

  3. In the Explorer pane, expand your project, click Datasets, and then click the dataset.

  4. Click Overview > Tables, and then click the name of the table that you want to snapshot.

  5. In the details pane that appears, click Snapshot.

    A screenshot showing the Snapshot button in the BigQuery console. [A screenshot showing the Snapshot button in the BigQuery console.]

  6. In the Create table snapshot pane that appears, enter the Project, Dataset, and Table information for the new table snapshot.

  7. In the Expiration time field, enter the date and time for 24 hours from now.

  8. Click Save.

SQL

Use the CREATE SNAPSHOT TABLE DDL statement:

  1. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  2. In the query editor, enter the following statement:

    CREATE SNAPSHOT TABLE SNAPSHOT_PROJECT_ID.SNAPSHOT_DATASET_NAME.SNAPSHOT_NAME
    CLONE TABLE_PROJECT_ID.TABLE_DATASET_NAME.TABLE_NAME
      OPTIONS (
        expiration_timestamp = TIMESTAMP 'TIMESTAMP_VALUE');

    Replace the following:

    • SNAPSHOT_PROJECT_ID: the project ID of the project in which to create the snapshot.
    • SNAPSHOT_DATASET_NAME: the name of the dataset in which to create the snapshot.
    • SNAPSHOT_NAME: the name of the snapshot you are creating.
    • TABLE_PROJECT_ID: the project ID of the project that contains the table you are creating the snapshot from.
    • TABLE_DATASET_NAME: the name of the dataset that contains the table you are creating the snapshot from.
    • TABLE_NAME: the name of the table you are creating the snapshot from.
    • TIMESTAMP_VALUE: A timestamp value representing the date and time 24 hours from now.

  3. Click Run.

For more information about how to run queries, see Run an interactive query.

Note: The snapshot inherits the source table's encryption key.

bq

Enter the following command in the Cloud Shell:

Go to Cloud Shell

bq cp \
--snapshot \
--no_clobber \
--expiration=86400 \
TABLE_PROJECT_ID:TABLE_DATASET_NAME.TABLE_NAME \
SNAPSHOT_PROJECT_ID:SNAPSHOT_DATASET_NAME.SNAPSHOT_NAME

Replace the following:

The --no_clobber flag is required.

Note: The snapshot inherits the destination dataset's default encryption key.

API

Call the jobs.insert method with the following parameters:

Parameter Value
projectId The project ID of the project to bill for this operation.
Request body
{
  "configuration": {
    "copy": {
      "sourceTables": [
        {
          "projectId": "TABLE_PROJECT_ID",
          "datasetId": "TABLE_DATASET_NAME",
          "tableId": "TABLE_NAME"
        }
      ],
      "destinationTable": {
        "projectId": "SNAPSHOT_PROJECT_ID",
        "datasetId": "SNAPSHOT_DATASET_NAME",
        "tableId": "SNAPSHOT_NAME"
      },
      "operationType": "SNAPSHOT",
      "writeDisposition": "WRITE_EMPTY",
      "destinationExpirationTime":"TIMESTAMP_VALUE"
    }
  }
}

Replace the following:

As with tables, if an expiration is not specified, then the table snapshot expires after the default table expiration time or the dataset that contains the table snapshot.

Note: Because expiring a snapshot is the same as deleting it at a later time, creating a snapshot with an expiration time requires the bigquery.tables.deleteSnapshot permission.

Create a table snapshot using time travel

You can create a table snapshot of a table as it was one hour ago by using one of the following options:

Console

  1. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  2. In the left pane, click Explorer:

    Highlighted button for the Explorer pane. [Highlighted button for the Explorer pane.]

  3. In the Explorer pane, expand your project, click Datasets, and then click the dataset.

  4. Click Overview > Tables, and then click the name of the table that you want to snapshot.

  5. In the details pane that appears, click Snapshot.

    A screenshot showing the Snapshot button in the BigQuery console. [A screenshot showing the Snapshot button in the BigQuery console.]

  6. In the Create table snapshot pane that appears, enter the Project, Dataset, and Table information for the new table snapshot.

  7. In the Snapshot time field, enter the date and time for 1 hour ago.

  8. Click Save.

SQL

Use the CREATE SNAPSHOT TABLE DDL statement with a FOR SYSTEM_TIME AS OF clause:

  1. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  2. In the query editor, enter the following statement:

    CREATE SNAPSHOT TABLE SNAPSHOT_PROJECT_ID.SNAPSHOT_DATASET_NAME.SNAPSHOT_NAME
    CLONE TABLE_PROJECT_ID.TABLE_DATASET_NAME.TABLE_NAME
    FOR SYSTEM_TIME AS OF
      TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR);

    Replace the following:

    • SNAPSHOT_PROJECT_ID: the project ID of the project in which to create the snapshot.
    • SNAPSHOT_DATASET_NAME: the name of the dataset in which to create the snapshot.
    • SNAPSHOT_NAME: the name of the snapshot you are creating.
    • TABLE_PROJECT_ID: the project ID of the project that contains the table you are creating the snapshot from.
    • TABLE_DATASET_NAME: the name of the dataset that contains the table you are creating the snapshot from.
    • TABLE_NAME: the name of the table you are creating the snapshot from.

  3. Click Run.

For more information about how to run queries, see Run an interactive query.

bq

Enter the following command in the Cloud Shell:

Go to Cloud Shell

bq cp \
--no_clobber \
--snapshot \
TABLE_PROJECT_ID:TABLE_DATASET_NAME.TABLE_NAME@-3600000 \
SNAPSHOT_PROJECT_ID:SNAPSHOT_DATASET_NAME.SNAPSHOT_NAME

Replace the following:

The --no_clobber flag is required.

API

Call the jobs.insert method with the following parameters:

Parameter Value
projectId The project ID of the project to bill for this operation.
Request body
{
  "configuration": {
    "copy": {
      "sourceTables": [
        {
          "projectId": "TABLE_PROJECT_ID",
          "datasetId": "TABLE_DATASET_NAME",
          "tableId": "TABLE_NAME@-360000"
        }
      ],
      "destinationTable": {
        "projectId": "SNAPSHOT_PROJECT_ID",
        "datasetId": "SNAPSHOT_DATASET_NAME",
        "tableId": "SNAPSHOT_NAME"
      },
      "operationType": "SNAPSHOT",
      "writeDisposition": "WRITE_EMPTY"
    }
  }
}

Replace the following:

For more information about specifying a past version of a table, see Accessing historical data using time travel.

Table access control

To control access to tables in BigQuery, see Control access to resources with IAM.

When you create a table snapshot, table-level access to the table snapshot is set as follows:

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-11 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-11 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page