Skip to content

Decoders

Stream Processor decoders.

kxi.sp.decode.csv

Parses CSV data to a table.

Parameters:

Name Type Description Default
schema Union[str, kx.Table, dict[str, Union[str, bytes, kx.CharAtom]]]

A dictionary of column names where values are the desired output type, a dictionary of columns and their type characters, or a list of type characters.

required
delimiter Union[str, bytes, kx.CharAtom]

A field separator for the records in the encoded data, defaults to comma.

pykx.CharAtom(pykx.q('","'))
header CSVHeader

Whether encoded data starts with a header row.

<CSVHeader.always: 'always'>
exclude Union[List[str], List[int], kx.SymbolVector, kx.IntegralVector]

Columns to exclude from the output, specified by name or by index.

pykx.LongVector(pykx.q('`long$()'))

Returns:

Type Description
Pipeline

A pipeline comprised of the csv decoder, which can be joined to other pipelines.

kxi.sp.decode.json

Parse JSON data.

JSON data should be a char vector or byte vector, and will be parsed using the .j.k function from q.

Parameters:

Name Type Description Default
decode_each bool

Whether the data consists of a single JSON object, or a list of JSON objects that should each be decoded separately.

False

Returns:

Type Description
Pipeline

A pipeline comprised of the json decoder, which can be joined to other pipelines.

kxi.sp.decode.protobuf

Parse Protocol Buffer messages.

Parameters:

Name Type Description Default
message Union[str, bytes, kx.SymbolAtom]

The name of the Protocol Buffer message type to decode.

required
path Optional[Union[Path, str, kx.SymbolAtom]]

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

None
format Optional[CharString]

The Protocol Buffer message format to decode.

None
include_fields Union[bool, kx.BooleanAtom]

Whether the output should also include field names.

True

Returns:

Type Description
Pipeline

A pipeline comprised of the protobuf decoder, which can be joined to other pipelines.