The panko.storage.pymongo_base
Module¶
Common functions for MongoDB backend
-
class
panko.storage.pymongo_base.
Connection
(conf)¶ Bases:
panko.storage.base.Connection
Base event Connection class for MongoDB driver.
-
CAPABILITIES
= {'events': {'query': {'simple': True}}}¶
-
STORAGE_CAPABILITIES
= {'storage': {'production_ready': True}}¶
-
get_event_types
()¶ Return all event types as an iter of strings.
-
get_events
(event_filter, pagination=None)¶ Return an iter of models.Event objects.
- Parameters
event_filter – storage.EventFilter object, consists of filters for events that are stored in database.
pagination – Pagination parameters.
-
get_trait_types
(event_type)¶ Return a dictionary containing the name and data type of the trait.
Only trait types for the provided event_type are returned.
- Parameters
event_type – the type of the Event.
-
get_traits
(event_type, trait_name=None)¶ Return all trait instances associated with an event_type.
If trait_type is specified, only return instances of that trait type.
- Parameters
event_type – the type of the Event to filter by
trait_name – the name of the Trait to filter by
-
record_events
(event_models)¶ Write the events to database.
- Parameters
event_models – a list of models.Event objects.
-