Skip to content

Conversation

@yevgenypats
Copy link
Contributor

Playing with the idea of having only one plugin and protocol.

@yevgenypats yevgenypats changed the title move to one plugin wip feat!: SDK V4 (One plugin and protocol for sources and destinations) May 30, 2023
writers/batch.go Outdated
resources = make([]arrow.Record, 0)
if upsertBatch != r.Upsert {
w.flush(ctx, tableName, upsertBatch, resources)
resources = make([]*plugin.MessageInsert, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would consider resources = resources[:0] type syntax in here and below

return items
}

func (messages Messages) InsertMessage() Inserts {
Copy link
Member

@disq disq Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming isn't very clear here, sounds like you're inserting a message. Call it GetInserts() (or just Inserts()) maybe? (also, unused I think)

@@ -0,0 +1,199 @@
mode: set
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed I think

return s.testListenerConn.Dial()
}

func (s *PluginServe) Serve(ctx context.Context) error {
Copy link
Member

@disq disq Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The returned error here is not used (or is a hassle to use) from a main.go POV. Maybe make a ServeConsole() helper func that calls Serve with context.Background(), doesn't return error, but prints error to stderr (and exits with proper error code) instead? Could even be a generic helper fn, just needs to conform to Serve's signature of ctx-in-error-out.

SkipTimes bool // time of day types
SkipLargeTypes bool // e.g. large binary, large string
TimePrecision time.Duration
SkipDecimals bool
Copy link
Member

@erezrokah erezrokah Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like this is used anywhere.

Update: it was used but in this PR we don't add the decimal type column anymore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it's not shown on the diff for some reason (probably since the PR needs a rebase), but SkipMaps is not used either and we don't add the maps at all

@erezrokah
Copy link
Member

This branch is also missing a bunch of Scalar values, like scalar.Date32, scalar.Time, scalar.Float and scalar.Int, so we would need to sync that file with main. See https://github.com/cloudquery/plugin-sdk/tree/b7bcd9326eb87f43e77e509ec5151c7f4a6f01b4/scalar

MigrateForce: s.migrateMode == plugin.MigrateModeForce,
}, writeCh)
})
for _, table := range tables {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for _, table := range tables {
for _, table := range tables.FlattenTables() {

Maybe?

}, msgs)
})

for _, table := range tables {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for _, table := range tables {
for _, table := range tables.FlattenTables() {

Not sure if tables are unflattened here (or in Migrate) but we seem to be calling MigrateTable a lot?

yevgenypats added a commit that referenced this pull request Jun 26, 2023
Instead of this #915 (fix
rebase conflicts)

This introduce a single API for both destination and sources. Now
plugins should be able to both read and write.
This also goes together with a proto upgrade
https://github.com/cloudquery/plugin-pb-go/tree/main/pb/plugin/v3

---------

Co-authored-by: Herman Schaaf <[email protected]>
Co-authored-by: Kemal Hadimli <[email protected]>
Co-authored-by: Erez Rokah <[email protected]>
@yevgenypats
Copy link
Contributor Author

Closing in favour of #984

kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request Jul 15, 2023

#### Summary

Similar to #11696.
~~I had to comment change some of the tests due to cloudquery/plugin-sdk#982 and cloudquery/plugin-sdk#915 (comment), so not ready to merge~~

BEGIN_COMMIT_OVERRIDE
feat!: Upgrades the postgresql source plugin to use plugin-sdk v4. This version does not contain any user-facing breaking changes, but because it is now using CloudQuery gRPC protocol v3, it does require use of a destination plugin that also supports protocol v3. All recent destination plugin versions support this.

feat!: To enable CDC in this version you'll need to use the `cdc_id` configuration string property, instead of the `cdc` boolean one. Please refer to the [docs](https://www.cloudquery.io/docs/plugins/sources/postgresql/overview) for more information 
END_COMMIT_OVERRIDE

<!--
kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request Jul 17, 2023

#### Summary

This is based on the MemDB plugin from cloudquery/plugin-sdk#915

Fixes #11755

BEGIN_COMMIT_OVERRIDE
feat!: Upgrades the mysql source plugin to use plugin-sdk v4. This version does not contain any user-facing breaking changes, but because it is now using CloudQuery gRPC protocol v3, it does require use of a destination plugin that also supports protocol v3. All recent destination plugin versions support this.
END_COMMIT_OVERRIDE

<!--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants