Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.4k views
in Technique[技术] by (71.8m points)

Transfering A CSV File From Cloud Storage Into A BigQuery Partitioned Table Using BigQuery Transfer Service

I have created a BigQuery table, partitioned by month.

I now want to transfer a CSV stored in Google Cloud Storage to the table using BigQuery transfer.

However, my last attempt failed. For the destination table I put: table_a${run_time|"%m%d"} but returned the following error:

Invalid monthly partitioned partition key: 0117 (it ran on the 17th of January. Hence 0117.)

What should I put for destination table, given that the table has been partitioned by month?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If partitioned by month, the partition key is <year><month>, while you put <month><day>, for instance

create or replace table yourtable (ts timestamp)
PARTITION BY TIMESTAMP_TRUNC(ts, month)
AS select timestamp '2020-1-1 1:00:00' ts;

The created table will have one partition: yourtable$202001


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...