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

Method WriteTable

plugins/destination/azblob/client/write.go:14–43  ·  view source on GitHub ↗
(ctx context.Context, msgs <-chan *message.WriteInsert)

Source from the content-addressed store, hash-verified

12)
13
14func (c *Client) WriteTable(ctx context.Context, msgs <-chan *message.WriteInsert) error {
15 var s *filetypes.Stream
16
17 for msg := range msgs {
18 if s == nil {
19 table := msg.GetTable()
20
21 name := fmt.Sprintf("%s/%s.%s%s", c.spec.Path, table.Name, c.spec.Format, c.spec.FileSpec.Compression.Extension())
22 if !c.spec.NoRotate {
23 name += "." + uuid.NewString()
24 }
25
26 var err error
27 s, err = c.Client.StartStream(table, func(r io.Reader) error {
28 _, err := c.storageClient.UploadStream(ctx, c.spec.Container, name, r, nil)
29 return err
30 })
31 if err != nil {
32 return err
33 }
34 }
35
36 if err := s.Write([]arrow.RecordBatch{msg.Record}); err != nil {
37 _ = s.FinishWithError(err)
38 return err
39 }
40 }
41
42 return s.Finish()
43}
44
45func (c *Client) Write(ctx context.Context, msgs <-chan message.WriteMessage) error {
46 return c.writer.Write(ctx, msgs)

Callers

nothing calls this directly

Calls 2

WriteMethod · 0.95
FinishMethod · 0.65

Tested by

no test coverage detected