minos.common.protocol.avro.base

Classes

MinosAvroProtocol

Minos Avro Protocol class.

class MinosAvroProtocol[source]

Bases: MinosBinaryProtocol

Minos Avro Protocol class.

classmethod encode(value, schema, *args, batch_mode=False, **kwargs)[source]

Encoder in avro for database Values all the headers are converted in fields with double underscore name the body is a set fields coming from the data type.

Parameters
  • value (Any) – The data to be stored.

  • schema (Any) – The schema relative to the data.

  • args – Additional positional arguments.

  • batch_mode (bool) – If True the data is processed as a list of models, otherwise the data is processed as a single model.

  • kwargs – Additional named arguments.

Returns

A bytes object.

Return type

bytes

classmethod decode(data, *args, batch_mode=False, **kwargs)[source]

Decode the given bytes of data into a single dictionary or a sequence of dictionaries.

Parameters
  • data (bytes) – A bytes object.

  • args – Additional positional arguments.

  • batch_mode (bool) – If True the data is processed as a list of models, otherwise the data is processed as a single model.

  • kwargs – Additional named arguments.

Returns

A dictionary or a list of dictionaries.

Return type

Any

classmethod decode_schema(data, *args, **kwargs)[source]

Decode the given bytes of data into a single dictionary or a sequence of dictionaries.

Parameters
  • data (bytes) – A bytes object.

  • args – Additional positional arguments.

  • kwargs – Additional named arguments.

Returns

A tuple or a list of tuples.

Return type

Union[dict[str, Any], list[dict[str, Any]]]