MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / WriteTableBatch

Method WriteTableBatch

plugins/destination/mssql/client/write.go:18–36  ·  view source on GitHub ↗
(ctx context.Context, _ string, messages message.WriteInserts)

Source from the content-addressed store, hash-verified

16}
17
18func (c *Client) WriteTableBatch(ctx context.Context, _ string, messages message.WriteInserts) error {
19 if len(messages) == 0 {
20 return nil
21 }
22
23 table := messages[0].GetTable()
24 records := make([]arrow.RecordBatch, len(messages))
25 for i, m := range messages {
26 records[i] = m.Record
27 }
28
29 if useTVP(table) {
30 return c.insertTVP(ctx, table, records)
31 }
32
33 return c.doInTx(ctx, func(tx *sql.Tx) error {
34 return c.bulkInsert(ctx, tx, table, records)
35 })
36}

Callers

nothing calls this directly

Calls 4

insertTVPMethod · 0.95
doInTxMethod · 0.95
bulkInsertMethod · 0.95
useTVPFunction · 0.85

Tested by

no test coverage detected