1
我想從使用node.js API的谷歌雲功能創建外部表。該功能將從GCS存儲桶更改中觸發。我可以創建一個本地表,但不能創建一個外部表。在導入here的node.js api中,configuration.load元數據沒有設置將其指定爲外部表。這是我迄今爲止創建本地表的代碼。我的問題是「我如何使用Node.js的API來創建外部表的GCS桶」BigQuery Node.js API創建外部表
const projectId = "N"
const bigquery = BigQuery({
projectId: projectId
});
const storage = Storage({
projectId: projectId
});
const dataset = bigquery.dataset("dataset");
const table = dataset.table("test_data");
const bucket = storage.bucket("my-bucket");
const file = bucket.file("2017/03/02/*");
let job;
// Imports data from a GCS file into a table
return table.import(file,{"sourceFormat":"AVRO"})
.then((results) => {
job = results[0];
console.log(`Job ${job.id} started.`);
return job.promise();
})
.then((results) => {
console.log(`Job ${job.id} completed.`);
return results;
});