Fetch Schedule data from a BigQuery Table to another BigQuery Table (Scheduled queries)
I am really new to GCP
and I am trying to Query
in a GCP BigQuery
to fetch all data from one BigQuery table
and Insert all into another BigQuery table
I am trying the Following query where Project 1
& Dataset.Table1
is the Project where I am trying to read the data. and Project 2
and Dataset2.Table2
is the Table where I am trying to Insert all the data with the same Naming
SELECT * FROM `Project1.DataSet1.Table1` LIMIT 1000
insert INTO `Project2.Dataset2.Table2`
But am I receiving a query error message?
Does anyone know how to solve this issue?
There may be a couple of comments...
-
The syntax might be different =>
insert into table select
and so on - see DML statements in the standard SQL -
Such approach of data coping might not be very optimal considering time and cost. It might be better to use
bq cp -f ...
commands - see BigQuery Copy — How to copy data efficiently between BigQuery environments and bq command-line tool reference - if that is possible in your case.
The correct syntax of the query is as suggested by @al-dann. I will try to explain further with a sample query as below:
Query:
insert into `Project2.Dataset2.Table2`
select * from `Project1.DataSet1.Table1`
Input Table:
This will insert values into the second table as below:
Output Table: