Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menampilkan daftar snapshot tabel
Dokumen ini menjelaskan cara mendapatkan daftar snapshot tabel dalam set data BigQuery di konsol Google Cloud , dengan membuat kueri tabel INFORMATION_SCHEMA.TABLE_SNAPSHOTS, menggunakan perintah bq ls, atau dengan memanggil tables.list API. Panduan ini juga menjelaskan cara menampilkan daftar semua snapshot tabel dari tabel dasar yang ditentukan dengan membuat kueri tabel INFORMATION_SCHEMA.TABLE_SNAPSHOTS.
Dokumen ini ditujukan untuk pengguna yang sudah memahami tabel dan snapshot tabel BigQuery.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-17 UTC."],[[["\u003cp\u003eThis document explains how to list table snapshots within a BigQuery dataset using the Google Cloud console, SQL queries, the \u003ccode\u003ebq ls\u003c/code\u003e command, or the \u003ccode\u003etables.list\u003c/code\u003e API method.\u003c/p\u003e\n"],["\u003cp\u003eListing table snapshots requires the \u003ccode\u003ebigquery.tables.list\u003c/code\u003e permission, which is granted by roles like \u003ccode\u003ebigquery.dataUser\u003c/code\u003e, \u003ccode\u003ebigquery.dataViewer\u003c/code\u003e, \u003ccode\u003ebigquery.dataEditor\u003c/code\u003e, \u003ccode\u003ebigquery.dataOwner\u003c/code\u003e, or \u003ccode\u003ebigquery.admin\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTable snapshots can be identified by their \u003ccode\u003eSNAPSHOT\u003c/code\u003e type and viewed through the \u003ccode\u003eINFORMATION_SCHEMA.TABLE_SNAPSHOTS\u003c/code\u003e view by running a query, or using the \u003ccode\u003ebq ls\u003c/code\u003e command by specifying the project and dataset names.\u003c/p\u003e\n"],["\u003cp\u003eYou can query the \u003ccode\u003eINFORMATION_SCHEMA.TABLE_SNAPSHOTS\u003c/code\u003e view to get a list of all snapshots associated with a specific base table.\u003c/p\u003e\n"]]],[],null,["# List table snapshots\n====================\n\nThis document describes how to get a list of the table snapshots in a\nBigQuery dataset in the Google Cloud console, by querying the\n[`INFORMATION_SCHEMA.TABLE_SNAPSHOTS`](/bigquery/docs/information-schema-snapshots)\ntable, by using the [`bq ls`](/bigquery/docs/reference/bq-cli-reference#bq_ls)\ncommand, or by calling the [`tables.list`](/bigquery/docs/reference/rest/v2/tables/list)\nAPI. It also describes how to list all of the table snapshots of a\nspecified base table by querying the `INFORMATION_SCHEMA.TABLE_SNAPSHOTS` table.\nThis document is intended for users who are familiar with\nBigQuery\n[tables](/bigquery/docs/tables-intro) and\n[table snapshots](/bigquery/docs/table-snapshots-intro).\n\nPermissions and roles\n---------------------\n\nThis section describes the\n[Identity and Access Management (IAM) permissions](/bigquery/docs/access-control#bq-permissions)\nthat you need to list the table snapshots in a dataset, and the\n[predefined IAM roles](/bigquery/docs/access-control#bigquery)\nthat grant those permissions. The permissions and roles for listing table\nsnapshots are the same as the permissions and roles required for\n[listing other types of tables](/bigquery/docs/tables#list_tables_in_a_dataset).\n\n### Permissions\n\nTo list the table snapshots in a dataset, you need the following permission:\n\n### Roles\n\nThe predefined BigQuery roles that provide the required\npermission are as follows:\n\nList the table snapshots in a dataset\n-------------------------------------\n\nGetting a list of table snapshots in a dataset is similar to listing other\ntypes of tables. The table snapshots have the type `SNAPSHOT`.\n\nYou can list table snapshots by using one of the following options: \n\n### Console\n\n1. In the Google Cloud console, go to the **BigQuery** page.\n\n [Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. In the **Explorer** pane, expand the project and dataset nodes of the\n dataset whose table snapshots you want to list.\n\n3. You can identify the table snapshots in the dataset by their icon.\n\n### SQL\n\nQuery the\n[`INFORMATION_SCHEMA.TABLE_SNAPSHOTS` view](/bigquery/docs/information-schema-snapshots):\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n1. In the Google Cloud console, go to the **BigQuery** page.\n\n [Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. In the query editor, enter the following statement:\n\n ```googlesql\n SELECT\n *\n FROM\n PROJECT_ID.DATASET_NAME.INFORMATION_SCHEMA.TABLE_SNAPSHOTS;\n ```\n\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshots you want to list.\n - \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshots you want to list.\n\n \u003cbr /\u003e\n\n3. Click play_circle **Run**.\n\n \u003cbr /\u003e\n\nFor more information about how to run queries, see [Run an interactive query](/bigquery/docs/running-queries#queries).\n\nThe result looks similar to the following: \n\n```\n+---------------+----------------+------------------+--------------------+-------------------+-----------------+-----------------------------+\n| table_catalog | table_schema | table_name | base_table_catalog | base_table_schema | base_table_name | snapshot_time |\n+---------------+----------------+------------------+--------------------+-------------------+-----------------+-----------------------------+\n| myproject | mydataset | mysnapshot | basetableproject | basetabledataset | basetable | 2021-04-16 14:05:27.519 UTC |\n+---------------+----------------+------------------+--------------------+-------------------+-----------------+-----------------------------+\n```\n\n\u003cbr /\u003e\n\n### bq\n\nEnter the following command in the Cloud Shell:\n\n[Go to Cloud Shell](https://console.cloud.google.com/bigquery?cloudshell=true) \n\n```bash\nbq ls \\\nPROJECT_ID:DATASET_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshots you want to list.\n- \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshots you want to list.\n\n\u003cbr /\u003e\n\nThe output looks similar to the following: \n\n```\n+-------------------------+--------+---------------------+-------------------+\n| tableId | Type | Labels | Time Partitioning |\n+-------------------------+--------+---------------------+-------------------+\n| mysnapshot |SNAPSHOT| | |\n+-------------------------+--------+---------------------+-------------------+\n```\n\n\u003cbr /\u003e\n\n### API\n\nCall the\n[`tables.list`](/bigquery/docs/reference/rest/v2/tables/list)\nmethod with the following parameters:\n\nList the table snapshots of a specified base table\n--------------------------------------------------\n\nYou can list the table snapshots of a specified base table by querying the\n`INFORMATION_SCHEMA.TABLE_SNAPSHOTS` view: \n\n```googlesql\nSELECT\n *\nFROM\n PROJECT_ID.DATASET_NAME.INFORMATION_SCHEMA.TABLE_SNAPSHOTS\nWHERE\n base_table_name = 'books';\n \n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshots you want to list.\n- \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshots you want to list.\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [Get information about a table snapshot](/bigquery/docs/table-snapshots-metadata).\n- [Update a table snapshot's description, expiration date, or\n access policy](/bigquery/docs/table-snapshots-update).\n- [Delete a table snapshot](/bigquery/docs/table-snapshots-delete)."]]