流式导入 Big Query 时请求中不存在任何行

No rows present in the request when stream importing into Big Query

我正在尝试使用 tabledata.insert_all

将导入数据流式传输到大查询中
job_data = {
  kind: 'bigquery#tableDataInsertAllRequest',
  rows: [
    { json: { column_name: value} }
  ]
}

response = execute(
  api_method: bigquery.tabledata.insert_all,
  parameters: {
    projectId: config['project_id'],
    datasetId: DATASET_ID,
    tableId: table_id
  },
  body_object: job_data
)

但我总是收到以下错误信息

Google::APIClient::Request Sending API request post https://www.googleapis.com/bigquery/v2/projects/propane-tribute-90023/datasets/development/tables/api_requests_20150414/insertAll {"User-Agent"=>"My Test App/1.0 google-api-ruby-client/0.8.5 Mac OS X/10.9.5\n (gzip)", "Content-Type"=>"application/json", "Accept-Encoding"=>"gzip", "Authorization"=>"Bearer ya29.VgFYvU2nxGDhWiCdS47XRw0J-7GLenRry0Cd3AA2D1RDzMh5gnf-m85I5GeSr9oNW51OuUb9mdwObg", "Cache-Control"=>"no-store"}

Decompressing gzip encoded response (155 bytes)
Decompressed (261 bytes)
Google::APIClient::Request Result: 400 {"Vary"=>"X-Origin", "Content-Type"=>"application/json; charset=UTF-8", "Date"=>"Wed, 15 Apr 2015 03:14:17 GMT", "Expires"=>"Wed, 15 Apr 2015 03:14:17 GMT", "Cache-Control"=>"private, max-age=0", "X-Content-Type-Options"=>"nosniff", "X-Frame-Options"=>"SAMEORIGIN", "X-XSS-Protection"=>"1; mode=block", "Server"=>"GSE", "Alternate-Protocol"=>"443:quic,p=0.5", "Transfer-Encoding"=>"chunked"} => {"error"=>{"errors"=>[{"domain"=>"global", "reason"=>"invalid", "message"=>"No rows present in the request.", "locationType"=>"other", "location"=>"rows"}], "code"=>400, "message"=>"No rows present in the request."}}

有没有人遇到同样的问题并且知道如何解决?

谢谢。

确保为 table 架构中存在的所有列 headers 提供适当的值。提供单独的“json”条目将使用您提供的列数据填充各个行。除非您已经为名为 column_name 和 value 的变量赋值,否则您需要在 json 声明之后的语句中提供这些值。

tabledata.insert_all“行”操作的示例 Ruby 语法如下所示:

body = {
   "rows" =>[ 
      {"json" => { "person_id" => 10, "person_name" => "test"}}, 
      {"json" => { "person_id" => 11, "person_name" => "test2"}} 
   ]
}