0
votes

There are two bigquery projects: proj1 and proj2 proj2 is created recently and is empty. Proj1 has dataset1 and it has a table called table1. I want to create same table for proj2 (same schema with no data). I created dataset2 for proj2. I clicked on the copy table in the (proj1:dataset1)table1 and chose proj2 and dataset2 as destination and table2 as table name. When I click on copy it gives error: Not found: proj2:Dataset2

I am not sure what is the best way to copy schema but my approch was following this: copying the table and then empty it [https://stackguides.com/questions/54053998/copy-table-structure-alone-in-bigquery][1]

1

1 Answers

2
votes

You can use bq cp command:

bq cp project1:dataset.table project2:dataset.table

If you are willing to copy all tables:

bq mk --transfer_config \
      --project_id=target-project \
      --data_source=cross_region_copy \
      --target_dataset=target-dataset \
      --display_name='Dataset Copy' \
      --params='{"source_dataset_id":"source-dataset","source_project_id":"source-project"}'