BigQuery中的新数据时触发云功能 [英] Trigger cloud function when new data in BigQuery

查看:57
本文介绍了BigQuery中的新数据时触发云功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当新数据导入到BigQuery表中时,我想触发一个Cloud Function.理想情况下,我想提取所有已插入的行(一列是ISIN).

I would like to trigger a Cloud Function when new data has been imported into a BigQuery table. Ideally, I would like to extract all the rows (one column is ISIN) that have been inserted.

这有可能吗?

推荐答案

不幸的是,截至2021年1月,BigQuery都没有触发器作为本机功能:/但是您可以实现一个不错的解决方法!:)

Unfortunately BigQuery has no triggers as a native feature as of Jan 2021 :/ However there is a nice workaround you can implement! :)

您可能知道,GCP中几乎所有操作都记录到 Cloud Logging (以前是StackDriver Logging).在这篇文章中,他们演示了如何触发云BigQuery加载作业完成时起作用.这个想法很简单:

As you probably know, almost every operation in GCP is logged to Cloud Logging (previously StackDriver Logging). In this article they demonstrate how to trigger a Cloud Function whenever a BigQuery load job finishes. The idea is simple:

  1. Cloud Logging 中为BigQuery加载作业创建过滤器,以在发生时捕获加载作业终止.
  2. 创建接收器,从Cloud Logging到Pub/Sub主题./li>
  3. 将您的Cloud Function设置为此主题的使用者,并实施您的逻辑
  1. Create a filter for BigQuery load jobs in Cloud Logging to catch when load jobs terminate.
  2. Create a sink from Cloud Logging to Pub/Sub topic.
  3. Set your Cloud Function as a consumer on this topic and implement your logic

这篇关于BigQuery中的新数据时触发云功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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