【发布时间】:2020-07-31 14:22:35
【问题描述】:
我正在使用 Node 库与 BigQuery 集成。想知道如何使用 Table.insert 方法将 Geography 数据类型值存储在 Table 中。我尝试了一些类似下面的东西,但给出了错误
const options = {
datasetId: 'mydataset',
tableId: 'mytable',
rows: [
{
rec1:"raj",
rec2:"geography::Point('-6', '6', 4326)"
}
] }
const table = await bigqueryClient
.dataset(options.datasetId)
.table(options.tableId)
table.insert(options.rows, (err, resp) => {
if (err) {
console.log('*****err', err)
} else {
console.log('*****resp', resp)
} })
或者实现这一点的唯一方法是在 BigQuery 客户端上使用查询方法,查询格式如下?
insert `bigqueryproject1-279307.mydataset.mytable` (rec1,rec2) values ('raj', ST_GEOGPOINT(-6, 6) )
【问题讨论】: