public class JsonStreamWriter extends Object implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static class |
JsonStreamWriter.Builder |
| Modifier and Type | Method and Description |
|---|---|
com.google.api.core.ApiFuture<AppendRowsResponse> |
append(org.json.JSONArray jsonArr)
Writes a JSONArray that contains JSONObjects to the BigQuery table by first converting the JSON
data to protobuf messages, then using StreamWriter's append() to write the data.
|
com.google.api.core.ApiFuture<AppendRowsResponse> |
append(org.json.JSONArray jsonArr,
long offset)
Writes a JSONArray that contains JSONObjects to the BigQuery table by first converting the JSON
data to protobuf messages, then using StreamWriter's append() to write the data.
|
void |
close()
Closes the underlying StreamWriter.
|
com.google.protobuf.Descriptors.Descriptor |
getDescriptor()
Gets current descriptor
|
String |
getStreamName()
Gets streamName
|
static JsonStreamWriter.Builder |
newBuilder(String streamOrTableName,
TableSchema tableSchema)
newBuilder that constructs a JsonStreamWriter builder with BigQuery client being initialized by
StreamWriter by default.
|
static JsonStreamWriter.Builder |
newBuilder(String streamOrTableName,
TableSchema tableSchema,
BigQueryWriteClient client)
newBuilder that constructs a JsonStreamWriter builder.
|
public com.google.api.core.ApiFuture<AppendRowsResponse> append(org.json.JSONArray jsonArr)
jsonArr - The JSON array that contains JSONObjects to be writtenpublic com.google.api.core.ApiFuture<AppendRowsResponse> append(org.json.JSONArray jsonArr, long offset)
jsonArr - The JSON array that contains JSONObjects to be writtenoffset - Offset for deduplicationpublic String getStreamName()
public com.google.protobuf.Descriptors.Descriptor getDescriptor()
public static JsonStreamWriter.Builder newBuilder(String streamOrTableName, TableSchema tableSchema)
streamOrTableName - name of the stream that must follow
"projects/[^/]+/datasets/[^/]+/tables/[^/]+/streams/[^/]+" or table name
"projects/[^/]+/datasets/[^/]+/tables/[^/]+"tableSchema - The schema of the table when the stream was created, which is passed back
through WriteStreampublic static JsonStreamWriter.Builder newBuilder(String streamOrTableName, TableSchema tableSchema, BigQueryWriteClient client)
streamOrTableName - name of the stream that must follow
"projects/[^/]+/datasets/[^/]+/tables/[^/]+/streams/[^/]+"tableSchema - The schema of the table when the stream was created, which is passed back
through WriteStreamclient - public void close()
close in interface AutoCloseableCopyright © 2021 Google LLC. All rights reserved.