Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Mettre à jour les métadonnées d'un instantané de table
Ce document explique comment mettre à jour la description, la date d'expiration ou les règles d'accès d'un instantané de table à l'aide de la console Google Cloud , de la commande bq update ou de l'API tables.patch.
Il est destiné aux utilisateurs familiarisés avec les tables et les instantanés de table dans BigQuery.
Vous pouvez mettre à jour les métadonnées d'un instantané de table, mais vous ne pouvez pas mettre à jour ses données, car celles-ci sont en lecture seule. Pour mettre à jour les données d'un instantané de table, vous devez d'abord restaurer cet instantané vers une table standard, puis mettre à jour les données de la table standard. Pour en savoir plus, consultez la page Restaurer des instantanés de table.
Mettre à jour les métadonnées d'un instantané de table
Vous pouvez modifier la description, l'expiration et les règles d'accès d'un instantané de table de la même manière que vous modifiez les métadonnées d'une table standard. Certains exemples sont fournis dans les sections suivantes.
Mettre à jour la description
Vous pouvez modifier la description d'un instantané de table en utilisant l'une des options suivantes :
Console
Dans la console Google Cloud , accédez à la page BigQuery.
Dans le volet Explorateur, développez les nœuds de projet et d'ensemble de données de l'instantané de table que vous souhaitez mettre à jour.
Cliquez sur le nom de l'instantané de table.
Dans le volet de l'instantané qui s'affiche, cliquez sur Partager, puis sur Ajouter un compte principal.
Dans le volet Ajouter des comptes principaux qui s'affiche, saisissez l'identifiant du compte principal auquel vous souhaitez accorder l'accès à l'instantané de la table.
Dans la liste déroulante Sélectionner un rôle, sélectionnez BigQuery, puis Lecteur de données BigQuery.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/16 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/08/16 (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)."]]