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

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

问题描述

当 Google BigQuery 达到某个阈值时,我希望收到通知,最好是通过电子邮件.例如,如果查询是:

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

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

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 不提供在不涉及其他技术的情况下构建它所需的服务种类.但是,您应该能够使用 appengine 之类的东西(它确实具有 任务调度机制) 定期发出您的监控查询探针,检查作业的结果,并在结果中有非零行时发出警报.或者,您可以使用一些脚本并利用 BQ 命令行工具在本地执行此操作.

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.

您还可以通过使用 BQ 的 表装饰器 来优化内容,仅扫描数据如果您在调用系统中保留上次探测的执行情况,则自上次运行监控查询后到达.

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.

简而言之:其他东西需要发出查询并根据结果做出反应,但 BQ 当然可以评估数据.

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天全站免登陆