是否可以使用python使用googleapiclient使用pubsub通知创建计划查询?

问题描述 投票:0回答:1

我想使用Python创建动态计划的查询,并且我希望在查询完成后在PubSub上发布一条消息。我知道我可以从UI中做到这一点,但这不是我想要的。

当前,我正在这样做,但是“ notificationPubsubTopic”字段在请求中被忽略

import googleapiclient.http
from googleapiclient import discovery, errors
resource = discovery.build("bigquerydatatransfer", "v1")
body = {
    "notificationPubsubTopic": "projects/{my_project}/topics/{my_topic}",
    "scheduleOptions": {
        "disableAutoScheduling": False
    },
    "disabled": False,
    "displayName": "my_table_name",
    "dataSourceId": "scheduled_query",
    "destinationDatasetId": "test",
    "emailPreferences": {
        "enableFailureEmail": False
    },
    "params": {
        "query": "select 1",
        "write_disposition": "WRITE_TRUNCATE",
        "destination_table_name_template": "table_name_test"
    },
    "schedule": "every day 09:35"
}
creation_job = res.projects().transferConfigs().create(parent=project, body=body)
creation_job.execute()
python-3.x google-bigquery google-cloud-pubsub data-transfer
1个回答
0
投票

[如果有人感兴趣,Google几天前发布了datatransfer library的新版本,在创建传输配置时添加了对notification_pubsub_topic的支持。所以这个问题可以认为是封闭的

© www.soinside.com 2019 - 2024. All rights reserved.