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<Storage.AppendRowsResponse> |
append(org.json.JSONArray jsonArr,
boolean allowUnknownFields)
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<Storage.AppendRowsResponse> |
append(org.json.JSONArray jsonArr,
long offset,
boolean allowUnknownFields)
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 streamName,
Table.TableSchema tableSchema)
newBuilder that constructs a JsonStreamWriter builder with BigQuery client being initialized by
StreamWriter by default.
|
static JsonStreamWriter.Builder |
newBuilder(String streamName,
Table.TableSchema tableSchema,
BigQueryWriteClient client)
newBuilder that constructs a JsonStreamWriter builder.
|
public com.google.api.core.ApiFuture<Storage.AppendRowsResponse> append(org.json.JSONArray jsonArr, boolean allowUnknownFields)
jsonArr
- The JSON array that contains JSONObjects to be writtenallowUnknownFields
- if true, json data can have fields unknown to the BigQuery table.public com.google.api.core.ApiFuture<Storage.AppendRowsResponse> append(org.json.JSONArray jsonArr, long offset, boolean allowUnknownFields)
jsonArr
- The JSON array that contains JSONObjects to be writtenoffset
- Offset for deduplicationallowUnknownFields
- if true, json data can have fields unknown to the BigQuery table.public String getStreamName()
public com.google.protobuf.Descriptors.Descriptor getDescriptor()
public static JsonStreamWriter.Builder newBuilder(String streamName, Table.TableSchema tableSchema)
streamName
- 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 WriteStream
public static JsonStreamWriter.Builder newBuilder(String streamName, Table.TableSchema tableSchema, BigQueryWriteClient client)
streamName
- 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 WriteStream
client
- public void close()
close
in interface AutoCloseable
Copyright © 2021 Google LLC. All rights reserved.