第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將數(shù)據(jù)插入到 Google BigQuery 表的嵌套字段中

將數(shù)據(jù)插入到 Google BigQuery 表的嵌套字段中

Go
小唯快跑啊 2021-12-27 18:25:53
我在 Cloud BigQuery 中有一個表,但service.Tabledata.InsertAll調(diào)用確實將數(shù)據(jù)插入到嵌套字段中。// works jsonRow["name"] = bigquery.JsonValue("Name")// doesn't workjsonRow["geo_location.City.Names.en"] = bigquery.JsonValue("Irvine")rows[index] = new(bigquery.TableDataInsertAllRequestRows)rows[index].Json = jsonRowinsertRequest := &bigquery.TableDataInsertAllRequest{Rows: rows}insertRequest.IgnoreUnknownValues = truecall := service.Tabledata.InsertAll(project, dataset, "analytics_events", insertRequest)if res, err := call.Do(); err!=nil{   Log.Fatal("Unable to Insert to BigQuery ", err)   return err}
查看完整描述

2 回答

?
一只名叫tom的貓

TA貢獻(xiàn)1906條經(jīng)驗 獲得超3個贊

您實際上需要構(gòu)建一個與架構(gòu)結(jié)構(gòu)相匹配的對象結(jié)構(gòu)。


這里的困惑在于該行:


jsonRow["geo_location.City.Names.en"] = bigquery.JsonValue("Irvine")

不會創(chuàng)建您期望的對象結(jié)構(gòu)。您創(chuàng)建的 json 對象實際上如下所示:


{

  "geo_location.City.Names.en": "Irvine"

}

而你想要的東西看起來像:


{

  "geo_location": {

    "City": {

      "Names": {

        "en": "Irvine"

      }

    }

  }

}

所以你的代碼應(yīng)該是這樣的:


// Probably not valid code. Just guessing.

jsonRow["geo_location"] = bigquery.JsonObject()

jsonRow["geo_location"]["City"] = bigquery.JsonObject()

jsonRow["geo_location"]["City"]["Names"] = bigquery.JsonObject()

jsonRow["geo_location"]["City"]["Names"]["en"] = bigquery.JsonValue("Irvine")

希望有幫助。


查看完整回答
反對 回復(fù) 2021-12-27
?
紅顏莎娜

TA貢獻(xiàn)1842條經(jīng)驗 獲得超13個贊

您需要在客戶端構(gòu)造一個嵌套對象,而不是在 jsonRow 的鍵中使用點號表示法。


查看完整回答
反對 回復(fù) 2021-12-27
  • 2 回答
  • 0 關(guān)注
  • 190 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號