我想简单的JSON数据加载到BigQuery资料表的方式如下:加载JSON数据到BigQuery资料表
$ bq load \
--apilog \
--source_format=NEWLINE_DELIMITED_JSON \
my_dataset.my_table \
./input.json ./schema.json
但收到以下错误信息:
Upload complete.
Waiting on bqjob_xxxx_xxx ... (3s) Current status: DONE
BigQuery error in load operation: Error processing job 'my_project_id:bqjob_xxxx_xxx': CSV table encountered too many errors, giving up. Rows: 1; errors: 1.
Failure details:
- file-00000000: Error detected while parsing row starting at
position: 0. Error: Data between close double quote (") and field
separator.
它抱怨一些CSV错误,但我试图加载JSON(--source_format=NEWLINE_DELIMITED_JSON
)
我的input.json
包含此数据:
{"domain":"stackoverflow.com","key":"hello","value":"world"}
我schema.json
如下:2.0.25
[
{
"name": "domain",
"type": "string",
"mode": "nullable"
},
{
"name": "key",
"type": "string",
"mode": "nullable"
},
{
"name": "value",
"type": "string",
"mode": "nullable"
}
]
bq
版本:
$ gcloud version | grep ^bq
bq 2.0.25
最好使用'bq --apilog - load ...'或'bq --apilog''load ...',因为没有参数'--apilog'使用'load'作为参数。 –