Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Visualiza metadatos de instantáneas de tablas
En este documento, se describe cómo ver los metadatos de una instantánea de tabla de BigQuery en la consola de Google Cloud mediante una consulta a la vista TABLE_SNAPSHOTS de la tabla INFORMATION_SCHEMA mediante el comando bq show o mediante una llamada a la API de tables.get.
Está dirigido a usuarios que estén familiarizados con las tablas y las instantáneas de tablas de BigQuery.
En el panel Explorador, expande los nodos del proyecto y del conjunto de datos de la instantánea de tabla que deseas ver.
Haz clic en el nombre de la instantánea de la tabla.
En el panel instantáneas que aparece, puedes hacer lo siguiente:
Haz clic en la pestaña Esquema para ver el esquema y las etiquetas de política de la instantánea de tabla.
Haz clic en la tabla Detalles para ver el tamaño, el vencimiento, la tabla base, el tiempo de la instantánea y otra información de la instantánea de la tabla.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-03-04 (UTC)"],[[["\u003cp\u003eThis document details how to view metadata for BigQuery table snapshots using the Google Cloud console, SQL queries, the \u003ccode\u003ebq show\u003c/code\u003e command, or the \u003ccode\u003etables.get\u003c/code\u003e API.\u003c/p\u003e\n"],["\u003cp\u003eViewing table snapshot metadata requires the \u003ccode\u003ebigquery.tables.get\u003c/code\u003e permission, which is granted by roles like \u003ccode\u003ebigquery.metadataViewer\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 snapshot metadata is similar to standard table metadata, but includes a \u003ccode\u003ebaseTableReference\u003c/code\u003e to identify the source table and has a \u003ccode\u003etype\u003c/code\u003e field set to \u003ccode\u003eSNAPSHOT\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can query the \u003ccode\u003eINFORMATION_SCHEMA.TABLE_SNAPSHOTS\u003c/code\u003e view to retrieve metadata details about a table snapshot, or use \u003ccode\u003ebq show\u003c/code\u003e in the command line.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003etables.get\u003c/code\u003e API method allows you to retrieve the table snapshot metadata, and needs the \u003ccode\u003eprojectId\u003c/code\u003e, \u003ccode\u003edatasetId\u003c/code\u003e, and \u003ccode\u003etableId\u003c/code\u003e to identify the snapshot.\u003c/p\u003e\n"]]],[],null,["# View table snapshot metadata\n============================\n\nThis document describes how to view the metadata for a BigQuery table\nsnapshot in the Google Cloud console, by querying the [`TABLE_SNAPSHOTS`](/bigquery/docs/information-schema-snapshots)\nview of the\n`INFORMATION_SCHEMA` table, by using the [`bq show`](/bigquery/docs/reference/bq-cli-reference#bq_show)\ncommand, or by calling the\n[`tables.get`](/bigquery/docs/reference/rest/v2/tables/get) API.\nIt 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) permission](/bigquery/docs/access-control#bq-permissions)\nthat you need to view 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 view 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\nGet a table snapshot's metadata\n-------------------------------\n\nThe metadata for a table snapshot is similar to the metadata for a standard\ntable, with the following differences:\n\n- An additional `baseTableReference` field identifies the base table that the snapshot was taken from.\n- The `type` field has the value `SNAPSHOT`.\n\nYou can view the metadata 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 look at.\n\n3. Click the name of the table snapshot.\n\n4. In the snapshot pane that appears, you can do the following:\n\n - Click the **Schema** tab to view the table snapshot's schema and\n policy tags.\n\n - Click the **Details** table to view the table snapshot's size,\n expiration, base table, snapshot time, and other information.\n\n### SQL\n\nTo see metadata for a table snapshot, query 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 WHERE\n table_name = '\u003cvar translate=\"no\"\u003eSNAPSHOT_NAME\u003c/var\u003e';\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 show \\\n--format=prettyjson \\\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\nThe output is similar to the following: \n\n```json\n{\n \"creationTime\": \"1593194331936\",\n ...\n \"snapshotDefinition\": {\n \"baseTableReference\": {\n \"datasetId\": \"myDataset\",\n \"projectId\": \"myProject\",\n \"tableId\": \"mytable\"\n },\n \"snapshotTime\": \"2020-06-26T17:58:50.815Z\"\n },\n \"tableReference\": {\n \"datasetId\": \"otherDataset\",\n \"projectId\": \"myProject\",\n \"tableId\": \"mySnapshot\"\n },\n \"type\": \"SNAPSHOT\"\n}\n```\n\n### API\n\nCall the\n[`tables.get`](/bigquery/docs/reference/rest/v2/tables/get)\nmethod with the following parameters:\n\nThe response body is similar to the following: \n\n```json\n{\n \"kind\": \"bigquery#table\",\n \"etag\": \"...\",\n \"id\": \"myProject:myDataset.mySnapshot\",\n \"selfLink\": \"https://content-bigquery.googleapis.com/bigquery/v2/projects/myProject/datasets/myDataset/tables/mySnapshot\",\n \"tableReference\": {\n \"projectId\": \"myProject\",\n \"datasetId\": \"myDataset\",\n \"tableId\": \"mySnapshot\"\n },\n \"description\": \"...\",\n \"schema\": {\n \"fields\": [\n ...\n ]\n },\n \"numBytes\": \"637931\",\n \"numLongTermBytes\": \"0\",\n \"numRows\": \"33266\",\n \"creationTime\": \"1593194331936\",\n \"lastModifiedTime\": \"1593194331936\",\n \"type\": \"SNAPSHOT\",\n \"location\": \"US\",\n \"snapshotDefinition\": {\n \"baseTableReference\": {\n \"projectId\": \"myProject\",\n \"datasetId\": \"otherDataset\",\n \"tableId\": \"myTable\"\n },\n \"snapshotTime\": \"2020-06-26T17:58:50.815Z\"\n }\n}\n```\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\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)."]]