File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
bigquery/storage/managedwriter Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -262,5 +262,21 @@ https://pkg.go.dev/google.golang.org/api/option#WithGRPCConnectionPool
262262
263263A reasonable upper bound for the connection pool size is the number of concurrent writers for explicit stream
264264plus the configured size of the multiplex pool.
265+
266+ # Writing JSON Data
267+
268+ As an example, you can refer to this integration test that demonstrates writing JSON data to a stream:
269+ https://github.com/googleapis/google-cloud-go/blob/7a46b5428f239871993d66be2c7c667121f60a6f/bigquery/storage/managedwriter/integration_test.go#L397
270+
271+ This integration test assumes the destination table already exists. In addition, it relies upon having a definition of
272+ a BigQuery schema that is compatible with this table (for this example the schema is defined here:
273+ https://github.com/googleapis/google-cloud-go/blob/2020edff24e3ffe127248cf9a90c67593c303e18/bigquery/storage/managedwriter/testdata/schemas.go#L31).
274+ Given the schema, this test first utilizes the function setupDynamicDescriptors() to derive both a MessageDescriptor
275+ and DescriptorProto from the schema. This function is defined here:
276+ https://github.com/googleapis/google-cloud-go/blob/7a46b5428f239871993d66be2c7c667121f60a6f/bigquery/storage/managedwriter/integration_test.go#L100
277+ The test initializes the ManagedStream it will write to with the derived DescriptorProto. The test then iterates
278+ through each of the JSON rows to be written. For each row, it first dynamically creates an empty Message based on
279+ the derived MessageDescriptor. Then it loads the JSON row into the Message. Finally it generates protocol buffer
280+ bytes from the Message. These bytes are then sent to the ManagedStream within an AppendRows request.
265281*/
266282package managedwriter
You can’t perform that action at this time.
0 commit comments