分段上传到 Google Bigquery

Multipart upload to Google Bigquery

我正在尝试将我的加载作业(多部分)构建到 Bigquery 中。按照 https://cloud.google.com/bigquery/loading-data-post-request#multipart 上的示例:

-foo_bar_baz
Content-Type: application/json; charset=UTF-8

{
  "configuration": {
    "load": {
      "sourceFormat": "NEWLINE_DELIMITED_JSON",
      "schema": {
        "fields": [
            {"name":"word","type":"STRING"},
            {"name":"word_count","type":"INTEGER"},
            {"name":"corpus","type":"STRING"},
            {"name":"corpus_date","type":"INTEGER"}
        ]
      },
      "destinationTable": {
        "projectId":"myproject",
        "datasetId":"mydataset",
        "tableId":"mytable"
      }
    }
  }
}

--foo_bar_baz
Content-Type: */*

[MY-JSON-DATA]
--foo_bar_baz--

但我从 google 那里收到消息说:

"message": "Job configuration must contain exactly one job-specific configuration object (e.g., query, load, extract, spreadsheetExtract), but there were 0: "

如果我查看 https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.load 上的文档,似乎需要 sourceUris[],但该示例不包含它。我的数据不在 google 云存储中,而是在请求中。为什么它检测不到我的负载详细信息?

感谢您的帮助。 //莱夫

根据消息 - 下方似乎缺少您

Content-Type: multipart/related; boundary="foo_bar_baz"

你是对的。我在 header 中有一个额外的 space 用于 Content-Type,我使用 fiddler 看到它,它看起来像这样:

`Content-Type:multipart/related;边界="foo_bar_baz"

感谢您的支持。