public class JsonStreamWriter implements AutoCloseableA StreamWriter that can write JSON data (JSONObjects) to BigQuery tables. The JsonStreamWriter is built on top of a StreamWriter, and it simply converts all JSON data to protobuf messages then calls StreamWriter's append() method to write to BigQuery tables.
This client lib is deprecated, please use v1 instead.
Implements
AutoCloseableStatic Methods
newBuilder(String streamOrTableName, TableSchema tableSchema) (deprecated)
public static JsonStreamWriter.Builder newBuilder(String streamOrTableName, TableSchema tableSchema)newBuilder that constructs a JsonStreamWriter builder with BigQuery client being initialized by StreamWriter by default.
| Parameters | |
|---|---|
| Name | Description |
streamOrTableName |
Stringname of the stream that must follow "projects/[^/]+/datasets/[^/]+/tables/[^/]+/streams/[^/]+" or table name "projects/[^/]+/datasets/[^/]+/tables/[^/]+" |
tableSchema |
TableSchemaThe schema of the table when the stream was created, which is passed back
through |
| Returns | |
|---|---|
| Type | Description |
JsonStreamWriter.Builder |
Builder |
newBuilder(String streamOrTableName, TableSchema tableSchema, BigQueryWriteClient client) (deprecated)
public static JsonStreamWriter.Builder newBuilder(String streamOrTableName, TableSchema tableSchema, BigQueryWriteClient client)newBuilder that constructs a JsonStreamWriter builder.
| Parameters | |
|---|---|
| Name | Description |
streamOrTableName |
Stringname of the stream that must follow "projects/[^/]+/datasets/[^/]+/tables/[^/]+/streams/[^/]+" |
tableSchema |
TableSchemaThe schema of the table when the stream was created, which is passed back
through |
client |
BigQueryWriteClient |
| Returns | |
|---|---|
| Type | Description |
JsonStreamWriter.Builder |
Builder |
Methods
append(JSONArray jsonArr) (deprecated)
public ApiFuture<AppendRowsResponse> append(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.
| Parameter | |
|---|---|
| Name | Description |
jsonArr |
org.json.JSONArrayThe JSON array that contains JSONObjects to be written |
| Returns | |
|---|---|
| Type | Description |
ApiFuture<AppendRowsResponse> |
|
append(JSONArray jsonArr, long offset) (deprecated)
public ApiFuture<AppendRowsResponse> append(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.
| Parameters | |
|---|---|
| Name | Description |
jsonArr |
org.json.JSONArrayThe JSON array that contains JSONObjects to be written |
offset |
longOffset for deduplication |
| Returns | |
|---|---|
| Type | Description |
ApiFuture<AppendRowsResponse> |
|
close() (deprecated)
public void close()Closes the underlying StreamWriter.
getDescriptor() (deprecated)
public Descriptors.Descriptor getDescriptor()Gets current descriptor
| Returns | |
|---|---|
| Type | Description |
Descriptor |
Descriptor |
getStreamName() (deprecated)
public String getStreamName()Gets streamName
| Returns | |
|---|---|
| Type | Description |
String |
String |