What's new in CloudQuery Go SDK v4

July 10, 2023

Yevgeny Pats
Name
Yevgeny Pats
Twitter
@yevgenypats

We are thrilled to announce the release of the new Go SDK v4, which brings exciting enhancements to writing CloudQuery plugins in Go!

The new Go SDK v4 version utilizes the gRPC plugin protocol version v3 (opens in a new tab), so be sure to check What's new in CloudQuery Plugin Protocol v3.

Overview

Let's begin with a high-level summary before diving deeper into each of the updates:

  • Apache Arrow - Given that the underlying protocol is all about Arrow, the Go SDK also speaks Arrow and utilizes the Apache Arrow Go (opens in a new tab) for data and data types.
  • Unified API for Sources and Destinations - Similar to the underlying gRPC protocol, the Go SDK now contains only one Plugin API, which enables CloudQuery plugins to function as both a source and a destination simultaneously.
  • Transition Sync/Write to Streaming API - Similar to the underlying protocol, the SDK has also transitioned the Sync and Write methods to a streaming-based API, enabling new use cases like Change Data Capture (CDC).

Apache Arrow

We extensively discussed this update in our previous blog post. Now, with all our destinations migrated to SDK V4, they support over 30 different Apache Arrow data types (opens in a new tab)!

Unified API

Plugins can now serve as both sources and destinations, and they have a single entry point: plugins.NewPlugin (opens in a new tab). Plugin authors can choose to implement only Sync functionality or only Write functionality.

Another big advantage, as mentioned in What's new in CloudQuery Plugin Protocol v3, is the ability to use any destination as a backend for incremental syncs.

Streaming API

Similar to the underlying protocol's supported messages for Sync and Write, the Go SDK messages are defined in plugin-sdk/message (opens in a new tab).

With this change to streaming that contains messages, we can easily extend the protocol in a backward-compatible way to support more messages like DeleteTable, DeleteRecord, to support use cases such as CDC or other use cases that require those kinds of data updates.

Migration Guide

There are a few things to consider when migrating, but for the most part, it will be just a syntactic change.

Go is not a great language for frameworks, so we made the Plugin SDK lightweight and moved other heavy functionality to its own sub-packages, which makes it easier to extend and test.

If you are migrating sources, take a look at our homebrew plugin PR (opens in a new tab).

Summary

We are thrilled about this major release! Don't hesitate to try your hand at developing a new CloudQuery plugin. Feel free to reach out to us on GitHub (opens in a new tab) or Discord (opens in a new tab) with any questions or feedback.