我想使用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()
[如果有人感兴趣,Google几天前发布了datatransfer
library的新版本,在创建传输配置时添加了对notification_pubsub_topic
的支持。所以这个问题可以认为是封闭的