Skip to content

Commit fb09f20

Browse files
authored
feat: Skip table validation during init (#1536)
#### Summary Not all source plugins are able to generate the list of tables at initialization time. For example S3 source needs to list and then download the object in order to generate the table. This can have a super high cost as a bucket can have near limitless amount of data
1 parent a336085 commit fb09f20

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

plugin/plugin.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ type Plugin struct {
8080
schemaValidator *jsonschema.Schema
8181
// skips the usage client
8282
skipUsageClient bool
83+
// skips table validation
84+
skipTableValidation bool
8385
}
8486

8587
// NewPlugin returns a new CloudQuery Plugin with the given name, version and implementation.
@@ -144,6 +146,11 @@ func (p *Plugin) SetSkipUsageClient(v bool) {
144146
p.skipUsageClient = v
145147
}
146148

149+
// SetSkipTableValidation sets whether table validation should be skipped
150+
func (p *Plugin) SetSkipTableValidation(v bool) {
151+
p.skipTableValidation = v
152+
}
153+
147154
type OnBeforeSender interface {
148155
OnBeforeSend(context.Context, message.SyncMessage) (message.SyncMessage, error)
149156
}

plugin/validate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ func validateTables(tables schema.Tables) error {
2323
}
2424

2525
func (p *Plugin) validate(ctx context.Context) error {
26+
if p.skipTableValidation {
27+
return nil
28+
}
2629
tables, err := p.client.Tables(ctx, TableOptions{Tables: []string{"*"}})
2730
// ErrNotImplemented means it's a destination only plugin
2831
if err != nil && !errors.Is(err, ErrNotImplemented) {

0 commit comments

Comments
 (0)