Skip to content

Encoders

Stream Processor encoders.

kxi.sp.encode.JSONEncoder (Encoder)

kxi.sp.encode.ProtobufEncoder (Encoder)

kxi.sp.encode.Encoder (Operator)

kxi.sp.encode.PayloadType (AutoNameEnum)

Enum to specify the payload type for a protobuf encoding.

kxi.sp.encode.PayloadType.array

array.

kxi.sp.encode.PayloadType.arrays

arrays.

kxi.sp.encode.PayloadType.auto

auto.

kxi.sp.encode.PayloadType.dict

dictionary.

kxi.sp.encode.PayloadType.table

table.

kxi.sp.encode.json

Encodes data as JSON.

Parameters:

Name Type Description Default
split bool

Whether a batch should be encoded as a single JSON object, or split into a separate JSON object for each value in the batch. When the input is a table, this encodes each row as a JSON object with the column names as keys mapping to the corresponding row values.

False

Returns:

Type Description
Encoder

A json encoder, which can be joined to other operators or pipelines.

kxi.sp.encode.protobuf

Encodes data as per protobuf.

Parameters:

Name Type Description Default
message str

The name of the Protocol Buffer message type to encode.

required
path Optional[str]

The path to a .proto file containing the message type definition.

None
format Optional[str]

A string definition of the Protocol Buffer message format to encode.

None
payload_type Optional[kxi.sp.encode.PayloadType]

A PayloadType enum value, or the string equivalent.

None

Returns:

Type Description
Encoder

A protobuf encoder, which can be joined to other operators or pipelines.