我正在尝试将数据上传到bigquery表
这是表格架构:
[{
"name": "temp",
"type": "STRING"
}]
这是我正在上传的文件:
{"temp" : "0"}
{"temp1" : "1"}
{"temp2" : "2"}
{"temp3" : "3"}
{"temp4" : "4"}
{"temp5" : "5"}
{"temp6" : "6"}
{"temp7" : "7"}
{"temp" : "8"}
{"temp" : "9"}
这是用于上传启用错误的bq命令:
bq load --source_format=NEWLINE_DELIMITED_JSON --max_bad_records=100 mydataset.mytable ./tmp.json
我收到:
Upload complete.
Waiting on bqjob_123.._1 ... (2s) Current status: DONE
Warnings encountered during job execution:
JSON parsing error in row starting at position 15 at file: file-00000000. No such field: temp1.
JSON parsing error in row starting at position 31 at file: file-00000000. No such field: temp2.
JSON parsing error in row starting at position 47 at file: file-00000000. No such field: temp3.
JSON parsing error in row starting at position 63 at file: file-00000000. No such field: temp4.
JSON parsing error in row starting at position 79 at file: file-00000000. No such field: temp5.
现在我正在使用:
bq --format=prettyjson show -j <jobId>
这就是我得到的(我在这里只复制了相关的字段):
{
"configuration": {
...
"maxBadRecords": 100
}
,
"statistics": {
"load": {
"inputFileBytes": "157",
"inputFiles": "1",
"outputBytes": "9",
"outputRows": "3"
}
},
"status": {
"errors": [
{
"message": "JSON parsing error in row starting at position 15 at file: file-00000000. No such field: temp1.",
"reason": "invalid"
},
{
"message": "JSON parsing error in row starting at position 31 at file: file-00000000. No such field: temp2.",
"reason": "invalid"
},
{
"message": "JSON parsing error in row starting at position 47 at file: file-00000000. No such field: temp3.",
"reason": "invalid"
},
{
"message": "JSON parsing error in row starting at position 63 at file: file-00000000. No such field: temp4.",
"reason": "invalid"
},
{
"message": "JSON parsing error in row starting at position 79 at file: file-00000000. No such field: temp5.",
"reason": "invalid"
}
],
"state": "DONE"
}
}
现在,当我去我的桌子时,我实际上有3条新记录(实际上与outputRows : 3
字段匹配):
{"temp" : "0"}
{"temp" : "8"}
{"temp" : "9"}
现在这些是我的问题:
如你所见,我有6个不良记录,我只收到其中的5个。 - 没有收到temp6。现在我尝试上传包含更多错误记录的文件,并且总是只收到5.这是一个很大的错误吗?
假设我的记录较大并且我上传了许多记录以启用错误,上传后如何才能知道哪些记录是坏记录? - 我需要知道哪些记录没有加载到bigquery。
我得到的只是JSON parsing error in row starting at position 15 at file..
位置并没有告诉我多少。为什么我不能收到记录的号码?或者有没有办法按位置计算记录数?
答案 0 :(得分:3)