如何根据BigQuery查询触发电子邮件或其他通知? [英] How can I trigger an email or other notification based on a BigQuery query?

查看:180
本文介绍了如何根据BigQuery查询触发电子邮件或其他通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Google BigQuery满足某些阈值时,我希望收到通知,理想情况是通过电子邮件发送。例如,如果查询是:

  SELECT name,count(id)FROM terrible_things 
WHERE date(terrible_thing) < -1d

然后我希望在结果大于0时得到警报,而且我会希望该警报包含每个对象的名称以及有多少个对象。

解决方案

BigQuery不提供各种服务我们需要在不涉及其他技术的情况下进行构建。但是,您应该可以使用类似appengine(具有任务计划机制)定期发出您的监视查询探针,检查作业的结果,并在结果中有非零行时发出警报。或者,您可以使用某些脚本在本地执行此操作,并利用BQ命令行工具。您还可以使用BQ的表修饰符,以便只扫描自上次运行监视查询以来到达的数据,如果您保留了最后一次探测执行的知识调用系统。

总之:还有其他需要发出查询并根据结果做出反应的情况,但BQ肯定可以评估数据。


I would like to receive a notification, ideally via email, when some threshold is met in Google BigQuery. For example, if the query is:

SELECT name, count(id) FROM terrible_things
WHERE date(terrible_thing) < -1d

Then I would want to get an alert when there were greater than 0 results, and I would want that alert to contain the name of each object and how many there were.

解决方案

BigQuery does not provide the kinds of services you'd need to build this without involving other technologies. However, you should be able to use something like appengine (which does have a task scheduling mechanism) to periodically issue your monitoring query probe, check the results of the job, and alert if there are nonzero rows in the results. Alternately, you could do this locally using some scripting and leveraging the BQ command line tool.

You could also refine things by using BQ's table decorators to only scan the data that's arrived since you last ran your monitoring query, if you retain knowledge of the last probe's execution in the calling system.

In short: Something else needs to issue the queries and react based on the outcome, but BQ can certainly evaluate the data.

这篇关于如何根据BigQuery查询触发电子邮件或其他通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆