我想使用google-api-nodejs-client将行流式传输到Google BigQuery。
深入研究源代码,我发现我需要一个“资源”参数。我尝试了几种组合并找到了apirequest的来源,但我总是得到错误No rows present in the request.
我终于设法用另一个npm 模块一次上传一行,但这个模块不支持 tabledata.insertAll()。
你能举一个例子来说明如何使用“资源”参数来流式插入吗?
bigquery.tabledata.insertAll({
auth: oauth2Client,
'projectId': config.google.projectId,
'datasetId': config.google.datasetId,
'tableId': config.google.tableId,
'resource ': {
"kind": "bigquery#tableDataInsertAllRequest",
"rows": [
{
"insertId": 123456,
"json": '{"id": 123,"name":"test1"}'
}
]
}
}, function(err, result) {
if (err) {
return console.error(err);
}
console.log(result);
});