我正在嘗試使用 bigquery golang 庫(kù)將數(shù)組插入到表中。我有一個(gè)看起來(lái)像這樣的表模式。該數(shù)組是quality列,具有Repeated. tableSchema := bigquery.Schema{ {Name: "issue_id", Type: bigquery.StringFieldType}, {Name: "quality", Type: bigquery.StringFieldType, Repeated: true}, {Name: "creation_date_ts", Type: bigquery.TimestampFieldType}, }這就是我定義記錄的方式:type escalationsRecord struct { IssueID bigquery.NullString `bigquery:"issue_id"` Quality []string `bigquery:"quality"` CreationTime bigquery.NullTimestamp `bigquery:"creation_date_ts"`}這就是我創(chuàng)建記錄的方式: record := escalationsRecord{ IssueID: bigquery.NullString{StringVal: fmt.Sprint(int(issue.Number)), Valid: true}, Quality: qualityArray, CreationTime: bigquery.NullTimestamp{Timestamp: issue.CreatedAt.Time, Valid: true}, }records = append(records, &record) 這就是我將記錄放入 BigQuery 的方式inserter := table.Inserter()err2 := inserter.Put(b.ctx, records)quality當(dāng)我在 bigqyery 中查看時(shí),該列為 NULL 。沒(méi)有錯(cuò)誤。該數(shù)組包含元素。知道如何正確插入數(shù)組嗎?我在文檔中找不到任何內(nèi)容。
Golang BigQuery:將數(shù)組插入表中
慕田峪9158850
2023-03-15 15:29:55