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

Function TVPQuery

plugins/destination/mssql/queries/tvp.go:71–85  ·  view source on GitHub ↗
(schemaName string, table *schema.Table, records []arrow.RecordBatch)

Source from the content-addressed store, hash-verified

69}
70
71func TVPQuery(schemaName string, table *schema.Table, records []arrow.RecordBatch) (query string, params []any, err error) {
72 rows, err := GetRows(array.NewTableFromRecords(table.ToArrowSchema(), records))
73 if err != nil {
74 return "", nil, err
75 }
76
77 return "exec " + sanitizeID(schemaName, tvpProcName(table)) + " @TVP;",
78 []any{
79 sql.Named("TVP", mssql.TVP{
80 TypeName: sanitizeID(schemaName, tvpTableType(table)),
81 Value: tableTransformer(table)(rows),
82 }),
83 },
84 nil
85}
86
87type transformer func([][]any) any
88

Callers

nothing calls this directly

Calls 5

GetRowsFunction · 0.85
tvpProcNameFunction · 0.85
tvpTableTypeFunction · 0.85
tableTransformerFunction · 0.85
sanitizeIDFunction · 0.70

Tested by

no test coverage detected