Google Bigquery: Partition specification needed to copy a split date table

Note: this is almost a duplicate of this question, with the difference that in this case the source table is split by date, and the destination table does not yet exist. In addition, the decision taken on this issue in this case did not work.

I am trying to copy data for one day from one broken table by date into a new table with a batch of date that I have not created yet. I hope that BigQuery will simply create for me a partition assignment table by date, as is usually done for a non-date case.

Using the BigQuery CLI, here is my command:

bq cp mydataset.sourcetable\$20161231 mydataset.desttable\$20161231

Here is the output of this command:

BigQuery error in cp operation: error handling work 'myproject: bqjob_bqjobid': section specification must be specified to create a partitioned table

I tried to do something similar using the python SDK: running the select command on a table by date (which selects data from only one date section) and saving the results to a new destination table (which, I hope, the date will also be split). Job failed with the same error:

{u'message ': u'Parting must be provided in order to create a partitioned table', u'reason ': u'invalid'}

Obviously, I need to add a shard specification, but I could not find the documentation on how to do this.

+4
source share
1 answer

( ):

, .

, . , , :

bq mk --time_partitioning_type=DAY mydataset.temps

. :

bq query --allow_large_results --replace --destination_table 'mydataset.temps$20160101''SELECT * from `source`'
+4

Source: https://habr.com/ru/post/1679434/


All Articles