當我試圖數據上傳到BigQuery資料表的BigQuery錯誤:</p> <pre><code>[{ "name": "temp", "type": "STRING" }] </code></pre> <p>這裏是我的文件,我上傳:上傳數據
這裏的表架構不接收所有不良記錄:
{"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"}
現在這些都是我qustions:
,你看,我有6個不良記錄我只接收5人。 - 沒有收到temp6。現在我嘗試上傳更糟糕的記錄文件,並始終只收到5.這是一個bigquery的bug?
假設我的記錄較大,並且我上傳了許多記錄後啓用錯誤,上傳後我怎麼知道哪些記錄是壞記錄? - 我需要知道哪些記錄沒有加載到bigquery中。 我得到的全部是
JSON parsing error in row starting at position 15 at file..
位置不會告訴我很多。爲什麼我不能收到記錄的號碼?或者有沒有辦法根據職位計算記錄編號?
複製並粘貼到記事本++中,然後單擊Ctrl + g並設置選項爲偏移量,以幫助您找到問題所在的確切行號 –