Reputation: 63
I have a set of queries I want to run each month in BQ. Let A > B denote that A DEPENDS on B. I have the below queries:
As you can see, Queries 2-4 depend on waiting for query 1 to be completed. I really like the "Scheduled query" system in bigquery, but is there anyway that I can leverage it do something like this? The main issue is I cant figure out how to tell my scheduled query to wait until some other query has finished in the BQ console. I know my alternative here is using Google BQ Jobs, but really wanted to see if this was possible to pull off with scheduled query system.
Upvotes: 1
Views: 770
Reputation: 10212
Run them all as a single script in the scheduled query. Use BEGIN...EXCEPTION block:
isert into q1_results
select ...
from table;
BEGIN
isert into q2_results
select ...
from q1_results;
EXCEPTION WHEN ERROR THEN
END;
BEGIN
isert into q3_results
select ...
from q1_results;
EXCEPTION WHEN ERROR THEN
END;
Upvotes: 1