I'm trying to copy one partitioned table into another one. According to the docs, this should be possible.
If you want to copy a partitioned table into another partitioned table, the partition specifications for the source and destination tables must match.
To test, I created two partitioned tables (partition1
& partition2
) with the same schema. I pushed 3 records into partition $20170101
on the partition1
table:
echo '{"a":1, "b":2}' | bq insert '<removed>.partition1$20170101'
echo '{"a":1, "b":2}' | bq insert '<removed>.partition1$20170101'
echo '{"a":1, "b":2}' | bq insert '<removed>.partition1$20170101'
That looks good:
Next, I pushed 2 records into the partition2
table and to the same partition ($20170101
):
echo '{"a":1, "b":2}' | bq insert '<removed>.partition2$20170101'
echo '{"a":1, "b":2}' | bq insert '<removed>.partition2$20170101'
Again, this looks good:
Now, I want to copy append partition2
into partition1
. I would expect to see 5 records in partition1
under the $20170101
partition:
bq cp --append_table <removed>.partition2 <removed>.partition1
Waiting on bqjob_r6d160e17a3b7b733_0000015bb238aa54_1 ... (0s) Current status: DONE
Tables '<removed>.partition2' successfully copied to '<removed>.partition1'
However, partition1
still only has 3 records in it.
What am I doing wrong?
bq cp --append_table <removed>.partition2 <removed>.partition1
- it definitely does not work. I triple checked. – Graham Polley