【问题标题】:Viewing the status of scheduled query in big query using list_transfer_configs使用 list_transfer_configs 查看大查询中计划查询的状态
【发布时间】:2021-05-19 09:58:23
【问题描述】:

我正在尝试创建一个云功能,该功能将检查某些预定查询的状态以触发另一个进程。我正在尝试在 main.py 中使用下面的

from google.cloud import bigquery
from google.cloud import bigquery_datatransfer
def extract_data(event, context):
    transfer_client = bigquery_datatransfer.DataTransferServiceClient()
    project_id = "projects/whr-asia-datalake-nonprod"
    configs = transfer_client.list_transfer_configs(parent=project_id)
    print("Got the following configs:")
    for config in configs:
      print(f"\tID: {config.name}, Schedule: {config.schedule}")

在 requirements.txt 中,我添加了下面的代码

google-cloud-bigquery-datatransfer==1
google-cloud-bigquery==1

如上所示得到空响应。我已经安排了今天运行的查询。可能是什么问题?

【问题讨论】:

  • 我实际上使用了你的代码作为基础,它对我有用,虽然我还没有在 CF 上尝试过,你能在你的云 shell 上运行这个脚本并检查它抛出给你的内容吗?
  • 我遇到了类似的问题,我认为该位置默认为美国,所以如果您在欧盟/亚洲有查询,那么它们是不可见的。在文档中看不到任何位置

标签: python google-cloud-platform google-bigquery google-cloud-functions


【解决方案1】:

我遇到了类似的问题,但只能看到几个查询。原来它默认只从美国拉取查询。

https://github.com/googleapis/google-cloud-python/issues/8466#issuecomment-610772303

不确定这是否完全是您的问题,但将位置添加到项目中,它应该从其他地区提取。

def get_scheduled_queries():
    transfer_client = bigquery_datatransfer.DataTransferServiceClient()
    parent = transfer_client.common_project_path(project_id + "/locations/EU")
    configs = transfer_client.list_transfer_configs(parent=parent)
    for config in configs:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-23
    • 2011-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-22
    • 2020-09-09
    相关资源
    最近更新 更多