JSONWriter

managedwriter. JSONWriter

A StreamWriter that can write JSON data to BigQuery tables. The JSONWriter is built on top of a Writer, and it simply converts all JSON data to protobuf messages then calls Writer's appendRows() method to write to BigQuery tables. It maintains all Writer functions, but also provides an additional feature: schema update support, where if the BigQuery table schema is updated, users will be able to ingest data on the new schema after some time (in order of minutes).

Constructor

new JSONWriter(params)

Creates a new JSONWriter instance.

Parameters:
Name Type Description
params WriterOptions

The parameters for the JSONWriter. See WriterOptions docs for more information.

See:

Extends

Methods

appendRows(rows, offsetValue?) → {managedwriter.PendingWrite}

Writes a JSONList that contains objects to be written to the BigQuery table by first converting the JSON data to protobuf messages, then using Writer's appendRows() to write the data at current end of stream. If there is a schema update, the current Writer is closed and reopened with the updated schema.

Parameters:
Name Type Description
rows JSONList

The list of JSON rows.

offsetValue? number | Long | string | null

The offset value.

Returns:
Type Description
managedwriter.PendingWrite

The pending write.

Overrides:

setDefaultMissingValueInterpretation(defaultMissingValueInterpretation)

Update how missing values are interpreted for the given stream.

Parameters:
Name Type Description
defaultMissingValueInterpretation MissingValueInterpretation
Overrides:

setMissingValueInterpretations(missingValueInterpretations)

Update how missing values are interpreted for individual columns.

Parameters:
Name Type Description
missingValueInterpretations MissingValueInterpretationMap
Overrides:

setProtoDescriptor(protoDescriptor)

Update the proto descriptor for the Writer. Internally a reconnection event is gonna happen to apply the new proto descriptor.

Parameters:
Name Type Description
protoDescriptor IDescriptorProto

The proto descriptor.

Overrides: