I am trying fire a query (Google BigQuery) in a for loop and in each loop inserting data into a table. However, I only see the final row in the table. So I'm assuming it is overwriting the values.
Here is the code:
for x in proc_arr:
query = """
BEGIN
<QUERY>
SELECT * FROM <table1> WHERE procedureid = {}
INSERT INTO <table>
SELECT procedureid FROM <tmp_proc1>
UNION ALL
SELECT procedureid FROM <tmp_proc2>
;
END;
""".format(x)
I have not written the actual query here as that is not required. proc_arr has 80 ids and it is only inserting data for the 80th id. Any help is appreciated. Thanks!


