Notes from BenDesk: Copying Tables in BigQuery

Ben is our resident ZenDesk captain and manager of all help@ inquiries. We’re bringing you interesting inquiries from his inbox each month.

Question of the Month: What happens when I click “Copy” when viewing a table in BigQuery, and why does that button disappear sometimes?

BenDesk Answer: BigQuery makes it easy to create a full copy of a table using the Copy button in the BigQuery UI. Copying a table is also one way to rename a table (an alternative to Alter Table Rename To).

However, the ‘Copy’ button is unavailable for all tables. Why? Google’s help documentation on BigQuery shares a few reasons, but the two most-likely for PAD users include: 1) trying to copy a view or; 2) trying to copy an external table. For example, if your data source is Google Sheets, BigQuery considers this an external table. This causes the ‘Copy’ button to disappear from the UI.

Never fear — even without the ‘Copy’ button, you only need a few lines of SQL to create a copy of the tables. Here’s some sample code you can use to essentially duplicate your tables:

CREATE TABLE`PROJECT_ID.SOURCE_DATASET_ID.SOURCE_TABLE_NAME` ASSELECT*FROM`PROJECT_ID.SOURCE_DATASET_ID.SOURCETABLE_NAME`;

Check out these recently published articles on NotePAD, our knowledge base for users, to learn more:

Do you have a question for BenDesk and the team? Partners can submit their asks to help@techallies.org.

Previous
Previous

Notes from BenDesk: Table Updates

Next
Next

Hop into the Pond