Home > Mobile >  Using managedwriter without a protocol definition
Using managedwriter without a protocol definition

Time:10-13

I am trying to use Go BigQuery Storage API Client. I checked that data can be inserted for most field types. However, preparing the protocol buffers definition isn't enjoyable every time I insert data. Java client has JsonStreamWriter class; it seems very useful.

Is there a way to insert data without a protocol buffers definition using Go client as Java client?

CodePudding user response:

The adapt subpackage of managedwriter includes functionality to convert a schema into a descriptor representation.

That, coupled with https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson should make it reasonable to use JSON as an intermediate format. There's an integration test in managedwriter that demonstrates this as well.

If you want to share more details about your specific conversion needs, please open an issue on the google-cloud-go repo with additional details.

  • Related