-
Notifications
You must be signed in to change notification settings - Fork 5
feat!: Upgrade to plugin-sdk v4 #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b479909
feat: Upgrade to plugin-sdk v4
disq 8685218
Remove sourceName from read
disq c3bb3e7
Remove unnecessary test
disq 44eb658
Merge branch 'main' into feat/sdkv4
disq 481690d
go mod tidy
disq cd5daa2
csv writer: strip `cq:extension:` metadata from columns, late flush
disq e9224c7
Merge branch 'main' into feat/sdkv4
disq 9f08f9e
update sdk, go mod tidy
disq 2d509d1
update sdk ref
disq 532d833
update sdk ref
disq 493fd14
strip, not keep
disq eab4192
Merge branch 'main' into feat/sdkv4
disq 0d3cf18
update sdk ref
disq 1d7e0b4
Add stream helper
disq 9abf428
Merge branch 'main' into feat/sdkv4
disq 4948ce1
Tidy
disq f1b4bb9
update testdata
disq 3585cd8
replace `if !assert.NoError(t, ...) return` with `require.NoError(t, …
disq ab63f05
Use 4.2.0-rc1
disq 33cbe0a
Merge branch 'main' into feat/sdkv4
disq d62fca0
tidy
disq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,33 +9,12 @@ import ( | |
|
|
||
| "github.com/apache/arrow/go/v13/arrow" | ||
| "github.com/bradleyjkemp/cupaloy/v2" | ||
| "github.com/cloudquery/filetypes/v3/types" | ||
| "github.com/cloudquery/plugin-sdk/v3/plugins/destination" | ||
| "github.com/cloudquery/plugin-sdk/v3/schema" | ||
| "github.com/cloudquery/filetypes/v4/types" | ||
| "github.com/cloudquery/plugin-sdk/v4/plugin" | ||
| "github.com/cloudquery/plugin-sdk/v4/schema" | ||
| "github.com/google/uuid" | ||
| ) | ||
|
|
||
| func TestWrite(t *testing.T) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case was removed because |
||
| var b bytes.Buffer | ||
| table := schema.TestTable("test", schema.TestSourceOptions{}) | ||
| sourceName := "test-source" | ||
| syncTime := time.Now().UTC().Round(time.Second) | ||
| opts := schema.GenTestDataOptions{ | ||
| SourceName: sourceName, | ||
| SyncTime: syncTime, | ||
| MaxRows: 1, | ||
| } | ||
| records := schema.GenTestData(table, opts) | ||
| cl, err := NewClient() | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| if err := types.WriteAll(cl, &b, table, records); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| t.Log(b.String()) | ||
| } | ||
|
|
||
| func TestWriteRead(t *testing.T) { | ||
| table := schema.TestTable("test", schema.TestSourceOptions{}) | ||
| sourceName := "test-source" | ||
|
|
@@ -77,12 +56,12 @@ func TestWriteRead(t *testing.T) { | |
| ch := make(chan arrow.Record) | ||
| var readErr error | ||
| go func() { | ||
| readErr = cl.Read(byteReader, table, "test-source", ch) | ||
| readErr = cl.Read(byteReader, table, ch) | ||
| close(ch) | ||
| }() | ||
| totalCount := 0 | ||
| for got := range ch { | ||
| if diff := destination.RecordDiff(records[totalCount], got); diff != "" { | ||
| if diff := plugin.RecordDiff(records[totalCount], got); diff != "" { | ||
| t.Fatalf("got diff: %s", diff) | ||
| } | ||
| totalCount++ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call is required for the csv writer to actually write the records, on write it compares the schema given to the
csv.NewWriterwith the record schema, which (in our case) turns out to be slightly different and missing thecq:extension:*things. So we strip them here from both places (since they don't hold any actionable info for csv writing)