【发布时间】:2021-08-12 17:26:25
【问题描述】:
我正在尝试通过 GCP 中的云函数触发计划查询。我尝试遵循几个教程和示例并浏览了文档,但是使用新版本的 API google-cloud-bigquery-datatransfer==3.1.1 我找不到任何显示正确程序的内容。
您将在我当前的代码下方找到:
from google.cloud import bigquery_datatransfer_v1
def triggerQuery (parent, requested_run_time):
client = bigquery_datatransfer_v1.DataTransferServiceClient()
project_id = '###' # Enter your projectID here
location_id = 'europe' # Enter your locationID here
transfer_id = '###' # Enter your transferId here
transfer_config = {...}
path = f"projects/{project_id}/locations/{location_id}/transferConfigs/{transfer_id}"
parent = client.transfer_config_path(project_id, transfer_id)
response = client.start_manual_transfer_runs(path)
print(response)
我尝试将client.start_manual_transfer_runs 传递给path 或parent,但我得到了:
TypeError: Invalid constructor input for StartManualTransferRunsRequest: 'projects/###/locations/europe/transferConfigs/###'
我还需要指定云函数与有权在 BigQuery 中运行查询的正确服务帐户相关联。
我们将不胜感激!
【问题讨论】:
-
可以尝试输入
location_id的区域格式吗?例如,europe-west1
标签: python google-bigquery google-cloud-functions google-cloud-data-transfer