使用Cloud Pub/Sub主题在GCP中安排bq命令行 [英] Schedule a bq command line in GCP with Cloud Pub/Sub topic
本文介绍了使用Cloud Pub/Sub主题在GCP中安排bq命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我执行了一个命令行,以从视图中选择数据并将其导出到BigQuery中的登台表:
I have a command line that I execute to select data from view and exporting to a staging table in BigQuery:
bq mk --transfer_config --headless=true --project_id="XXXXXXX" --target_dataset=XXXXXX --display_name=XXXXXX --schedule='XXXXXX' --use_legacy_sql=false --params='{"query":"SELECT * FROM xxxxxxxx","destination_table_name_template":"xxxxxx","write_disposition":"WRITE_TRUNCATE"}' --data_source=scheduled_query --service_account_name="XXXXXXX@XXXXX.iam.gserviceaccount.com"
是否可以使用命令行设置Cloud Pub/Sub主题?
Is there any way to set the Cloud Pub/Sub topic using the command line?
预先感谢您的帮助!
推荐答案
很明显,通过命令行,您不能这样做.可以通过API调用使用这种有效负载
Obviously, by command line, you can't. It's possible by API call with this kind of payload
{
"notificationPubsubTopic":"projects/PROJECT/topics/TOPIC",
"scheduleOptions": {
"disableAutoScheduling":false,
"startTime":"2020-01-24T10:06:12.344Z"
},
"displayName":"test",
"dataSourceId":"scheduled_query",
"destinationDatasetId":"DATASET",
"emailPreferences":{"enableFailureEmail":false},
"params": {
"query":"SELECT 1",
"write_disposition":"WRITE_APPEND",
"destination_table_name_template":"test_schedule"
},
"schedule":"every day 10:06"
}
这篇关于使用Cloud Pub/Sub主题在GCP中安排bq命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文