1

我试图通过 bqcmd 将 json 文件推送到 BQ,其中包含特殊字符,例如 ü 但失败。我尝试了不同的编码等。除了删除字符之外没有任何工作

 {
    "productName": "soft drüum",
    "Category": "xxxxxxx",
    "subCategory": "Sun & Tan",
    "subSubCategory": "Sun",
    "productType": "Standard",
    "brandName": "soft drüum",
    "quantity": 1
}

Json File 在引入特殊字符之前是成功的

BQ 命令:

bq load --autodetect=true --time_partitioning_field date
--source_format NEWLINE_DELIMITED_JSON Data.products D:\XXXX\xx\products.json
4

1 回答 1

1

我会检查以确保您将 json 保存为新行分隔。在您的示例中,尾随逗号在换行分隔 JSON 中无效。

然后我可以通过以下命令上传这些特殊字符:

bq load --project_id=${project_id} --source_format NEWLINE_DELIMITED_JSON --autodetect ${database}.${table} ${nldjson_filename}
于 2022-02-01T14:52:57.607 回答