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

Method MigrateTable

plugins/destination/s3/client/write.go:95–116  ·  view source on GitHub ↗
(ctx context.Context, ch <-chan *message.WriteMigrateTable)

Source from the content-addressed store, hash-verified

93}
94
95func (c *Client) MigrateTable(ctx context.Context, ch <-chan *message.WriteMigrateTable) error {
96 // nolint:prealloc
97 var errs []error
98
99 for msg := range ch {
100 if !c.spec.GenerateEmptyObjects {
101 continue
102 }
103 table := msg.GetTable()
104 objKey := c.spec.ReplacePathVariables(table.Name, uuid.NewString(), time.Now().UTC(), c.syncID)
105 // We don't need any locking here because all messages for the same table are processed sequentially
106 c.initializedTables[table.Name] = objKey
107 s, err := c.createObject(ctx, table, objKey)
108 if err != nil {
109 errs = append(errs, err)
110 continue
111 }
112 errs = append(errs, s.Finish())
113 }
114
115 return errors.Join(errs...)
116}
117
118// sanitizeRecordJSONKeys replaces all invalid characters in JSON keys with underscores. This is required
119// for compatibility with Athena.

Callers

nothing calls this directly

Calls 3

createObjectMethod · 0.95
FinishMethod · 0.65
ReplacePathVariablesMethod · 0.45

Tested by

no test coverage detected