在 BigQuery 中安排查询 [英] Schedule query in BigQuery
问题描述
我有一个 BigQuery 查询,它结合了两个表(每日 Google Analytics 导出).我想要的是将查询保存为视图或表,但随着新的 Google Analytics 数据加载到 BigQuery 中,每天都会自动更新最终视图/表.
感谢您的帮助
更新
计划重复查询自 2018 年 9 月起在 BigQuery 中可用><小时>
BigQuery 本身不提供任何调度机制.
您可以使用第 3 方解决方案或使用您选择的客户端开发自己的解决方案
https://cloud.google.com/bigquery/docs/reference/libraries
例如
您可以使用 App Engine Cron 服务自动执行 BigQuery 查询https://cloud.google.com/appengine/docs/java/config/定时任务https://cloud.google.com/appengine/features/#cronhttps://cloud.google.com/bigquery/bigquery-api-quickstart
或者,您可以使用 Google Apps 脚本编写带有基于时间的触发器的 BigQuery 查询脚本以执行该脚本
https://developers.google.com/apps-script/advanced/bigqueryhttps://developers.google.com/apps-script/指南/触发器/可安装#time-driven_triggers
此外,请查看最近推出的 Google Cloud Functions(测试版)
https://cloud.google.com/functions/docs/
I have a BigQuery query which unions two tables (daily Google Analytics exports). What I want is to save the query as a view or table but have that final view/table update automatically everyday as the new Google Analytics data is loaded into BigQuery.
Thanks for your help
Update
Scheduling recurring queries is available now in BigQuery since September 2018
BigQuery by itself doesn’t provide any scheduling mechanism.
You can use 3rd party solution or develop your own using client of your choice
https://cloud.google.com/bigquery/docs/reference/libraries
For example,
You can use App Engine Cron Service to automate BigQuery query execution https://cloud.google.com/appengine/docs/java/config/cron https://cloud.google.com/appengine/features/#cron https://cloud.google.com/bigquery/bigquery-api-quickstart
Or, you can use Google Apps Script to script BigQuery query with a Time based trigger to execute that script
https://developers.google.com/apps-script/advanced/bigquery
https://developers.google.com/apps-script/guides/triggers/installable#time-driven_triggers
Also, check recently introduced Google Cloud Functions (Beta)
https://cloud.google.com/functions/docs/
这篇关于在 BigQuery 中安排查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!