Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Excluir snapshots da tabela
Neste documento, descrevemos como excluir um snapshot de tabela usando o
console do Google Cloud, uma
DROP SNAPSHOT TABLE
instrução do GoogleSQL, um comando
bq rm
ou uma chamada
tables.delete da API BigQuery.
Ele também fornece informações sobre como recuperar um snapshot de tabela que foi
excluído ou que expirou nos últimos sete dias.
Ele é destinado a usuários familiarizados com
os snapshots da tabela.
DATASET_NAME: o nome do conjunto de dados que contém o snapshot.
SNAPSHOT_NAME: o nome do snapshot.
API
Chame o método tables.delete com os seguintes parâmetros:
Parâmetro
Valor
projectId
O ID do projeto que contém o snapshot.
datasetId
O nome do conjunto de dados que contém o snapshot.
tableId
O nome do snapshot.
Restaurar um snapshot de tabela excluído ou expirado
É possível recuperar um snapshot de tabela que foi excluído ou que expirou nos últimos sete dias da mesma forma que você recupera uma tabela padrão. Para mais
informações, consulte
Restaurar tabelas excluídas.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-03-04 UTC."],[[["\u003cp\u003eTable snapshots can be deleted using the Google Cloud console, a \u003ccode\u003eDROP SNAPSHOT TABLE\u003c/code\u003e SQL statement, the \u003ccode\u003ebq rm\u003c/code\u003e command, or a BigQuery API \u003ccode\u003etables.delete\u003c/code\u003e call.\u003c/p\u003e\n"],["\u003cp\u003eTo delete a table snapshot, users need the \u003ccode\u003ebigquery.tables.deleteSnapshot\u003c/code\u003e permission, which is granted by the \u003ccode\u003ebigquery.dataOwner\u003c/code\u003e or \u003ccode\u003ebigquery.admin\u003c/code\u003e roles.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a table snapshot is similar to deleting a standard table, and expired snapshots do not need to be manually deleted.\u003c/p\u003e\n"],["\u003cp\u003eA table snapshot deleted or expired in the past seven days can be recovered in the same way a standard table is recovered.\u003c/p\u003e\n"]]],[],null,["# Delete table snapshots\n======================\n\nThis document describes how to delete a table snapshot by using the\nGoogle Cloud console, a\n[`DROP SNAPSHOT TABLE`](/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement)\nGoogleSQL statement, a\n[`bq rm`](/bigquery/docs/reference/bq-cli-reference#bq_rm) command,\nor a BigQuery API\n[`tables.delete`](/bigquery/docs/reference/rest/v2/tables/delete) call.\nIt also provides information about how to recover a table snapshot that was\ndeleted or that expired in the past seven days.\nIt is intended for users who are familiar with\n[table snapshots](/bigquery/docs/table-snapshots-intro).\n\nPermissions and roles\n---------------------\n\nThis section describes the\n[Identity and Access Management (IAM) permission](/bigquery/docs/access-control#bq-permissions)\nthat you need to delete a table snapshot, and the\n[predefined IAM roles](/bigquery/docs/access-control#bigquery)\nthat grant those permissions.\n\n### Permissions\n\nTo delete a table snapshot, you need the following permission:\n\n### Roles\n\nThe predefined BigQuery roles that provide the required\npermissions are as follows:\n\nDelete a table snapshot\n-----------------------\n\nDelete a table snapshot as you would delete a standard table. You don't need to\ndelete a table snapshot that has expired.\n\nYou can delete a table snapshot 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)\n\n1. In the **Explorer** pane, expand the project and dataset nodes of the\n table snapshot you want to look at.\n\n2. Click the name of the table snapshot.\n\n3. In the snapshot pane that appears, click **Delete**.\n\n4. Confirm, and then click **Delete** again.\n\n### SQL\n\nUse the\n[`DROP SNAPSHOT TABLE` DDL statement](/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement):\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 DROP SNAPSHOT TABLE PROJECT_ID.DATASET_NAME.SNAPSHOT_NAME;\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 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\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\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 rm \\\nPROJECT_ID:DATASET_NAME.SNAPSHOT_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 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.delete`](/bigquery/docs/reference/rest/v2/tables/delete)\nmethod with the following parameters:\n\nRestore a deleted or expired table snapshot\n-------------------------------------------\n\nYou can recover a table snapshot that was deleted or that expired in\nthe past seven days in the same way that you recover a standard table. For more\ninformation, see\n[Restore table snapshots](/bigquery/docs/table-snapshots-restore).\n\nWhat's next\n-----------\n\n- [Create monthly snapshots of a table by using a service account that runs a scheduled query](/bigquery/docs/table-snapshots-scheduled)."]]