Create table clones
This document describes how to copy a table to a
table clone by using a
CREATE TABLE CLONE
SQL statement, a bq cp
command, or a jobs.insert
API call. This document is intended for users who are familiar with
table clones.
Permissions and roles
This section describes the
Identity and Access Management (IAM) permissions
that you need to create a table clone, and the
predefined IAM roles
that grant those permissions.
Permissions
To create a table clone, you need the following permissions:
Permission |
Resource |
All of the following:
bigquery.tables.get
bigquery.tables.getData
|
The table that you want to make a clone of. |
bigquery.tables.create
bigquery.tables.updateData
|
The dataset that contains the table clone. |
Roles
The predefined BigQuery roles that provide the required
permissions are as follows:
Role |
Resource |
Any of the following:
bigquery.dataViewer
bigquery.dataEditor
bigquery.dataOwner
bigquery.admin
|
The table that you want to make a clone of. |
Any of the following:
bigquery.dataEditor
bigquery.dataOwner
bigquery.admin
|
The dataset that contains the new table clone. |
Create a table clone
Use GoogleSQL, the bq command-line tool, or the
BigQuery API to create a table clone.
SQL
To clone a table, use the
CREATE TABLE CLONE
statement.
In the Trusted Cloud console, go to the BigQuery page.
Go to BigQuery
In the query editor, enter the following statement:
CREATE TABLE
myproject.myDataset_backup.myTableClone
CLONE myproject.myDataset.myTable;
Click play_circle Run.
For more information about how to run queries, see Run an interactive query.
Replace the following:
PROJECT
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.
DATASET
is the name of the target dataset.
This dataset must be in the same region as the dataset
containing the table you are cloning.
CLONE_NAME
is name of the table clone that you are
creating.
bq
Use a bq cp
command
with the --clone
flag:
Go to Cloud Shell
bq cp --clone --no_clobber project1:myDataset.myTable PROJECT:DATASET.CLONE_NAME
Replace the following:
PROJECT
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.
DATASET
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.
CLONE_NAME
is name of the table clone that you are
creating.
The --no_clobber
flag is required.
If you are creating a clone in the same project as the base table, you
can skip specifying a project, as shown following:
bq cp --clone --no_clobber myDataset.myTable DATASET.CLONE_NAME
API
Call the
jobs.insert
method with the
operationType
field set to CLONE
:
Parameter |
Value |
projectId |
The project ID of the project that runs the job. |
Request body |
{
"configuration": {
"copy": {
"sourceTables": [
{
"projectId": "myProject",
"datasetId": "myDataset",
"tableId": "myTable"
}
],
"destinationTable": {
"projectId": "PROJECT",
"datasetId": "DATASET",
"tableId": "CLONE_NAME"
},
"operationType": "CLONE",
"writeDisposition": "WRITE_EMPTY",
}
}
} |
Replace the following:
PROJECT
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.
DATASET
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.
CLONE_NAME
is name of the table clone that you are
creating.
Access control
When you create a table clone, access to the table clone is set as follows:
What's next
- After you create a table clone, you can use it like you use standard tables.
For more information, see Manage tables.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\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)."]]