I am trying to insert data using INSERT INTO DML command into partitioned BigQuery table from a non-partitioned table .
Steps followed :
1.Creating empty partitioned table
CREATE TABLE project.dataset.tbl1
( field1 STRING, field2 STRING , field3 TIMESTAMP)
PARTITION BY DATE(field3)
OPTIONS(
partition_expiration_days=3,
description="a table partitioned "
)
2.Inserting data from table2 to table1
INSERT INTO dataset.tbl1
(field1, field2,field3) AS
select f1, f2,f3 from project.dataset.tbl2
where
DATE(f3) IN ('2018-09-13','2018-09-14','2018-09-15','2018-09-16') and f1 is not null and f2 is not null
The above DML statement gets executed but no records are inserted .So I check whether the SELECT query gets data or not.
The below fetches 13 records.
select f1, f2,f3 from project.dataset.tbl2
where
DATE(f3) IN ('2018-09-13','2018-09-14','2018-09-15','2018-09-16') and f1 is not null and f2 is not null