Reputation: 2973
Any idea how can I duplicate a big table with the partitions.
For example I have a table x with 1,000,000 row and 10 daily partitions I want to copy most of the data to a new table named y with the partition meta data.
is this possible?
Upvotes: 2
Views: 2525
Reputation: 11777
As far as duplicating the table, yes, it should be possible as stated in the docs.
If you are using the CLI you could just run a cp
command like:
bq cp dataset.old_partitioned_table dataset.new_partitioned_table
Or if using an API client just make sure to setup the configuration.copy properly when running a job resource.
You said in your question though that you want to "copy most of the data" so it looks like you want to have some sort of filter applied. One possibility could be duplicating the table and then running either some query or DML update to account for the changes you need.
Upvotes: 1