简体   繁体   中英

Schedule a query in Bigquery when a table come in Firebase Analytics Partition table

I am using the data exported from Firebase Analytics to Google Bigquery. Those table are partition by date in this format ProjectID.Dataset.table_YYYYMMDD example SELECT * FROM `PROJECTIID.analyticsxxxx.events_YYYYMMDD` LIMIT 1000 Unfortunately those table comes everyday on different time ( sometimes 10am, sometimes 5 am, sometimes 2 pm) I wonder if there is a way to use the "Scheduled queries" functionality of Bigquery with a "if" condition.

The If condition on my case will be to have a sensor to check if the partition table of yesterday is in than the scheduled query can run, if not wait until the table comes in.

You can use metatable __TABLES_SUMMARY__ to check for table existence and BigQuery scripting inside scheduled query like:

IF EXISTS (SELECT 1 FROM FROM <dataset>.__TABLES_SUMMARY__ WHERE table_id='mytablename') 
THEN
  ...
END IF;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM