The panko.storage.models Module

Model classes for use in the events storage API.

class panko.storage.models.Event(message_id, event_type, generated, traits, raw)

Bases: panko.storage.base.Model

A raw event from the source system. Events have Traits.

Metrics will be derived from one or more Events.

DEFAULT_DIR = 'asc'
DEFAULT_SORT = [('generated', 'asc'), ('message_id', 'asc')]
DUPLICATE = 1
INCOMPATIBLE_TRAIT = 3
PRIMARY_KEY = 'message_id'
SUPPORT_DIRS = ('asc', 'desc')
SUPPORT_SORT_KEYS = ('message_id', 'generated')
UNKNOWN_PROBLEM = 2
append_trait(trait_model)
serialize()
class panko.storage.models.Trait(name, dtype, value)

Bases: panko.storage.base.Model

A Trait is a key/value pair of data on an Event.

The value is variant record of basic data types (int, date, float, etc).

DATETIME_TYPE = 4
FLOAT_TYPE = 3
INT_TYPE = 2
NONE_TYPE = 0
TEXT_TYPE = 1
classmethod convert_value(trait_type, value)
classmethod get_name_by_type(type_id)
classmethod get_type_by_name(type_name)
get_type_name()
classmethod get_type_names()
serialize()
type_names = {0: 'none', 1: 'string', 2: 'integer', 3: 'float', 4: 'datetime'}
panko.storage.models.serialize_dt(value)

Serializes parameter if it is datetime.