say I have a table t1
which is date partitioned on column sdate
I have another table t2
which is also partitioned on column pdate
which has data already in some partitions (20200101 to 20200130)
Now, I want to overwrite few partitions ( 20200105 to 20200110) in t2
from data in t1
and I want to do it in a single query and not one query per partition.
Select Query:
SELECT sdate,
c1, c2
FROM `dataset.t1` where sdate between "2020-01-05" and "2020-01-10"
I have seen examples where we can specify destination table like t2$20200102
, but that will overwrite only a single partition.
How can we write insert statement to populate selected partitions
Any ideas of how the insert query would look like?