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 at current end
of stream.
|
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 at the
specified offset.
|
void |
close()
Closes the underlying StreamWriter.
|
com.google.protobuf.Descriptors.Descriptor |
getDescriptor()
Gets current descriptor
|
long |
getInflightWaitSeconds()
Returns the wait of a request in Client side before sending to the Server.
|
String |
getStreamName() |
String |
getWriterId() |
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) throws IOException, com.google.protobuf.Descriptors.DescriptorValidationException
jsonArr - The JSON array that contains JSONObjects to be writtenIOExceptioncom.google.protobuf.Descriptors.DescriptorValidationExceptionpublic com.google.api.core.ApiFuture<AppendRowsResponse> append(org.json.JSONArray jsonArr, long offset) throws IOException, com.google.protobuf.Descriptors.DescriptorValidationException
jsonArr - The JSON array that contains JSONObjects to be writtenoffset - Offset for deduplicationIOExceptioncom.google.protobuf.Descriptors.DescriptorValidationExceptionpublic String getStreamName()
public String getWriterId()
public com.google.protobuf.Descriptors.Descriptor getDescriptor()
public long getInflightWaitSeconds()
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 © 2022 Google LLC. All rights reserved.