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

Categories

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
4.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...