Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Memperbarui metadata snapshot tabel
Dokumen ini menjelaskan cara memperbarui deskripsi, tanggal habis masa berlaku, atau
kebijakan akses untuk snapshot
tabel menggunakan konsol Google Cloud , perintah bq update, atau
tables.patch API.
Panduan ini ditujukan bagi pengguna yang sudah memahami
tabel dan
snapshot tabel di BigQuery.
Anda dapat memperbarui metadata snapshot tabel, tetapi tidak dapat memperbarui datanya
karena data snapshot tabel bersifat hanya baca. Untuk memperbarui data snapshot tabel,
Anda harus memulihkan snapshot tabel ke tabel standar terlebih dahulu, lalu memperbarui
data tabel standar. Untuk mengetahui informasi selengkapnya, lihat
Memulihkan snapshot tabel.
Memperbarui metadata snapshot tabel
Anda dapat mengubah deskripsi, masa berlaku, dan kebijakan akses snapshot tabel
dengan cara yang sama seperti mengubah metadata tabel standar. Beberapa contohnya
disediakan di bagian berikut.
Memperbarui deskripsi
Anda dapat mengubah deskripsi untuk snapshot tabel menggunakan salah satu
opsi berikut:
[[["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 guide outlines the process for updating a table snapshot's metadata, including its description, expiration date, and access policies, within Google BigQuery.\u003c/p\u003e\n"],["\u003cp\u003eUpdating metadata requires the \u003ccode\u003ebigquery.tables.update\u003c/code\u003e permission, which is granted by roles such as \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 snapshot data itself cannot be directly updated; instead, users must restore the snapshot to a standard table to modify the data.\u003c/p\u003e\n"],["\u003cp\u003eChanges to the table snapshot's description or expiration can be done through the Google Cloud console, the \u003ccode\u003ebq update\u003c/code\u003e command, or the \u003ccode\u003etables.patch\u003c/code\u003e API method.\u003c/p\u003e\n"],["\u003cp\u003eAccess control updates, enabling a user to view the snapshot data, are done through the console's share option, the \u003ccode\u003ebq add-iam-policy-binding\u003c/code\u003e command, or the \u003ccode\u003etables.setIamPolicy\u003c/code\u003e API.\u003c/p\u003e\n"]]],[],null,["# Update table snapshot metadata\n==============================\n\nThis document describes how to update the description, expiration date, or\naccess policy for a table\nsnapshot by using the Google Cloud console, the [`bq update`](/bigquery/docs/reference/bq-cli-reference#bq_update)\ncommand, or the\n[`tables.patch`](/bigquery/docs/reference/rest/v2/tables/patch) API.\nIt is intended for users who are familiar with\n[tables](/bigquery/docs/tables-intro) and\n[table snapshots](/bigquery/docs/table-snapshots-intro) in BigQuery.\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 update the metadata for a table snapshot, and the\n[predefined IAM roles](/bigquery/docs/access-control#bigquery)\nthat grant those permissions.\n\n### Permissions\n\nTo update a table snapshot's metadata, you need the following permission:\n\n### Roles\n\nThe predefined BigQuery roles that provide the required\npermission are as follows:\n\nLimitations\n-----------\n\nYou can update a table snapshot's metadata, but you can't update its data\nbecause table snapshot data is read only. To update a table snapshot's data,\nyou must first restore the table snapshot to a standard table, and then update\nthe standard table's data. For more information, see\n[Restoring table snapshots](/bigquery/docs/table-snapshots-restore).\n\nUpdate a table snapshot's metadata\n----------------------------------\n\nYou can change a table snapshot's description, expiration, and access policies\nin the same way as you change a standard table's metadata. Some examples are\nprovided in the following sections.\n\n### Update the description\n\nYou can change the description for a table snapshot by using one of the\nfollowing 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 table snapshot you want to update.\n\n3. Click the name of the table snapshot.\n\n4. In the snapshot pane that appears, click the **Details** tab, and\n then click **Edit Details**.\n\n5. In the **Description** field, add or update the description for the\n table snapshot.\n\n6. Click **Save**.\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 update \\\n--description=\"\u003cvar translate=\"no\"\u003eDESCRIPTION\u003c/var\u003e\" \\\nPROJECT_ID:DATASET_NAME.SNAPSHOT_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDESCRIPTION\u003c/var\u003e: text describing the snapshot. For example, `Snapshot after table schema change X.`.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eSNAPSHOT_NAME\u003c/var\u003e: the name of the snapshot.\n\n\u003cbr /\u003e\n\n### API\n\nCall the\n[`tables.patch`](/bigquery/docs/reference/rest/v2/tables/patch)\nmethod with the following parameters:\n\nPrefer the `tables.patch` method over the `tables.update` method because the\n`tables.update` method replaces the entire `Table` resource.\n\n### Update the expiration\n\nYou can change the expiration of a table snapshot by using one of the\nfollowing 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 table snapshot you want to update.\n\n3. Click the name of the table snapshot.\n\n4. In the snapshot pane that appears, click the **Details** tab, and\n then click **Edit Details**.\n\n5. In the **Expiration time** field, enter the new expiration time for the\n table snapshot.\n\n6. Click **Save**.\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 update \\\n--expiration=EXPIRATION_TIME \\\nPROJECT_ID:DATASET_NAME.SNAPSHOT_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eEXPIRATION_TIME\u003c/var\u003e: the number of seconds from the current time to the expiration time.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eSNAPSHOT_NAME\u003c/var\u003e: the name of the snapshot.\n\n\u003cbr /\u003e\n\n### API\n\nCall the\n[`tables.patch`](/bigquery/docs/reference/rest/v2/tables/patch)\nmethod with the following parameters:\n\nPrefer the `tables.patch` method over the `tables.update` method because the\n`tables.update` method replaces the entire `Table` resource.\n\n### Update access\n\nYou can give a user access to view the data in a table snapshot by using\none 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 table snapshot you want to update.\n\n3. Click the name of the table snapshot.\n\n4. In the snapshot pane that appears, click **Share** , then click **Add\n principal**.\n\n5. In the **Add principals** pane that appears, enter the identifier of the\n [principal](/iam/docs/principals-overview) you want to\n give access to the table snapshot.\n\n6. In the **Select a role** dropdown, choose **BigQuery** , then\n **BigQuery Data Viewer**.\n\n7. Click **Save**.\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 add-iam-policy-binding \\\n --member=\"user:\u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e\" \\\n --role=\"roles/bigquery.dataViewer\" \\\n PROJECT_ID:DATASET_NAME.SNAPSHOT_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e: the [principal](/iam/docs/principals-overview) you want to give access to the table snapshot.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eSNAPSHOT_NAME\u003c/var\u003e: the name of the snapshot.\n\n\u003cbr /\u003e\n\n### API\n\nCall the\n[`tables.setIamPolicy`](/bigquery/docs/reference/rest/v2/tables/setIamPolicy)\nmethod with the following parameters:\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID of the project that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eDATASET_NAME\u003c/var\u003e: the name of the dataset that contains the snapshot.\n- \u003cvar translate=\"no\"\u003eSNAPSHOT_NAME\u003c/var\u003e: the name of the snapshot.\n- \u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e: the [principal](/iam/docs/overview#concepts_related_identity) you want to give access to the table snapshot.\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [List the table snapshots in a dataset](/bigquery/docs/table-snapshots-list).\n- [View the metadata for a table snapshot](/bigquery/docs/table-snapshots-metadata).\n- [Delete a table snapshot](/bigquery/docs/table-snapshots-delete)."]]