我正在嘗試使用 bigquery golang 庫將數組插入到表中。我有一個看起來像這樣的表模式。該數組是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"`}這就是我創建記錄的方式: 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當我在 bigqyery 中查看時,該列為 NULL 。沒有錯誤。該數組包含元素。知道如何正確插入數組嗎?我在文檔中找不到任何內容。
Golang BigQuery:將數組插入表中
慕田峪9158850
2023-03-15 15:29:55