[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-04。"],[[["\u003cp\u003eTable clones can be created using a \u003ccode\u003eCREATE TABLE CLONE\u003c/code\u003e SQL statement, the \u003ccode\u003ebq cp\u003c/code\u003e command-line tool, or a \u003ccode\u003ejobs.insert\u003c/code\u003e API call.\u003c/p\u003e\n"],["\u003cp\u003eCreating a table clone requires specific Identity and Access Management (IAM) permissions, including \u003ccode\u003ebigquery.tables.get\u003c/code\u003e, \u003ccode\u003ebigquery.tables.getData\u003c/code\u003e, \u003ccode\u003ebigquery.tables.create\u003c/code\u003e, and \u003ccode\u003ebigquery.tables.updateData\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003ePredefined BigQuery roles like \u003ccode\u003ebigquery.dataViewer\u003c/code\u003e, \u003ccode\u003ebigquery.dataEditor\u003c/code\u003e, \u003ccode\u003ebigquery.dataOwner\u003c/code\u003e, and \u003ccode\u003ebigquery.admin\u003c/code\u003e provide the necessary permissions for creating table clones.\u003c/p\u003e\n"],["\u003cp\u003eWhen a table clone is created, row-level and column-level access policies are copied from the base table, but table-level access depends on whether the clone overwrites an existing table or is a new resource.\u003c/p\u003e\n"],["\u003cp\u003eAfter creation, a table clone functions similarly to a standard table, and can be used with existing table management processes.\u003c/p\u003e\n"]]],[],null,["# Create table clones\n===================\n\nThis document describes how to copy a table to a\n[table clone](/bigquery/docs/table-clones-intro) by using a\n[`CREATE TABLE CLONE`](/bigquery/docs/reference/standard-sql/data-definition-language#create_table_clone_statement)\nSQL statement, a [`bq cp`](/bigquery/docs/reference/bq-cli-reference#bq_cp)\ncommand, or a [`jobs.insert`](/bigquery/docs/reference/rest/v2/jobs/insert)\nAPI call. This document is intended for users who are familiar with\n[table clones](/bigquery/docs/table-clones-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 create a table clone, and the\n[predefined IAM roles](/bigquery/docs/access-control#bigquery)\nthat grant those permissions.\n\n### Permissions\n\nTo create a table clone, you need the following permissions:\n\n### Roles\n\nThe predefined BigQuery roles that provide the required\npermissions are as follows:\n\nCreate a table clone\n--------------------\n\nUse GoogleSQL, the bq command-line tool, or the\nBigQuery API to create a table clone. \n\n### SQL\n\nTo clone a table, use the\n[CREATE TABLE CLONE](/bigquery/docs/reference/standard-sql/data-definition-language#create_table_clone_statement)\nstatement.\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 CREATE TABLE\n myproject.myDataset_backup.myTableClone\n CLONE myproject.myDataset.myTable;\n ```\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\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e is the project ID of the target project. This project must be in the same organization as the project containing the table you are cloning.\n- \u003cvar translate=\"no\"\u003eDATASET\u003c/var\u003e is the name of the target dataset. This dataset must be in the same region as the dataset containing the table you are cloning.\n- \u003cvar translate=\"no\"\u003eCLONE_NAME\u003c/var\u003e is name of the table clone that you are creating.\n\n### bq\n\nUse a [`bq cp`](/bigquery/docs/reference/bq-cli-reference#bq_cp) command\nwith the `--clone` flag:\n\n[Go to Cloud Shell](https://console.cloud.google.com/bigquery?cloudshell=true) \n\n```bash\nbq cp --clone --no_clobber project1:myDataset.myTable PROJECT:DATASET.CLONE_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e is the project ID of the target project. This project must be in the same organization as the project containing the table you are cloning.\n- \u003cvar translate=\"no\"\u003eDATASET\u003c/var\u003e is the name of the target dataset. This dataset must be in the same region as the dataset containing the table you are cloning. If the dataset is not in the same region as the dataset containing the table you are cloning then a full table is copied.\n- \u003cvar translate=\"no\"\u003eCLONE_NAME\u003c/var\u003e is name of the table clone that you are creating.\n\nThe `--no_clobber` flag is required.\n\nIf you are creating a clone in the same project as the base table, you\ncan skip specifying a project, as shown following: \n\n```bash\nbq cp --clone --no_clobber myDataset.myTable DATASET.CLONE_NAME\n```\n\n### API\n\nCall the\n[`jobs.insert`](/bigquery/docs/reference/rest/v2/jobs/insert) method with the\n`operationType` field set to `CLONE`:\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e is the project ID of the target project. This project must be in the same organization as the project containing the table you are cloning.\n- \u003cvar translate=\"no\"\u003eDATASET\u003c/var\u003e is the name of the target dataset. This dataset must be in the same region as the dataset containing the table you are cloning. If the dataset is not in the same region as the dataset containing the table you are cloning a full table is copied.\n- \u003cvar translate=\"no\"\u003eCLONE_NAME\u003c/var\u003e is name of the table clone that you are creating.\n\nAccess control\n--------------\n\nWhen you create a table clone, access to the table clone is set as follows:\n\n- [Row-level access policies](/bigquery/docs/row-level-security-intro) are copied from the base table to the table clone.\n- [Column-level access policies](/bigquery/docs/column-level-security-intro) are copied from the base table to the table clone.\n- [Table-level access](/bigquery/docs/table-access-controls-intro) is\n determined as follows:\n\n - If the table clone overwrites an existing table, then the table-level access for the existing table is maintained. [Tags](/bigquery/docs/tags) aren't copied from the base table.\n - If the table clone is a new resource, then the table-level access for the table clone is determined by the access policies of the dataset in which the table clone is created. Additionally, [tags](/bigquery/docs/tags) are copied from the base table to the table clone.\n\nWhat's next\n-----------\n\n- After you create a table clone, you can use it like you use standard tables. For more information, see [Manage tables](/bigquery/docs/managing-tables)."]]