我們的要求是以編程方式備份Google數據存儲並將這些備份加載到Google Big查詢以供進一步分析。我們成功地自動備份使用以下方法將Google數據存儲備份從數據存儲加載到Google BigQuery
Queue queue = QueueFactory.getQueue("datastoreBackupQueue");
/*
* Create a task which is equivalent to the backup URL mentioned in
* above cron.xml, using new queue which has Datastore admin enabled
*/
TaskOptions taskOptions = TaskOptions.Builder.withUrl("/_ah/datastore_admin/backup.create")
.method(TaskOptions.Method.GET).param("name", "").param("filesystem", "gs")
.param("gs_bucket_name",
"db-backup" + "/" + TimeUtils.parseDateToString(new Date(), "yyyy/MMM/dd"))
.param("queue", queue.getQueueName());
/*
* Get list of dynamic entity kind names from the datastore based on
* the kinds present in the datastore at the start of backup
*/
List<String> entityNames = getEntityNamesForBackup();
for (String entityName : entityNames) {
taskOptions.param("kind", entityName);
}
/* Add this task to above queue */
queue.add(taskOptions);
我能夠再導入這個備份手動谷歌的BigQuery,但我們如何自動完成這一過程?
我也看過大多數的文檔,並沒有任何幫助 https://cloud.google.com/bigquery/docs/loading-data-cloud-storage#loading_data_from_google_cloud_storage