Last updated 2 months ago

Events are time-stamped objects that contain data tied to that specific point in time. Complex events might have dozens or hundreds or variables recorded at a point in time, either as a sample or some real-world state, or as a discrete event.

Sentenai normalizes all datetimes to UTC, regardless of input timezone. This behavior applies specifically to an event's "global" timestamp, not any timestamp fields within the event.

Along with data and ts an Event includes:

  • The stream it belongs to

  • An id, which will auto-generate if one isn't provided

  • An exists flag to indicate whether it's been saved

stream = "example-sentenai-stream",
id = "55",
ts = datetime.datetime(2018, 1, 1, 3, 55),
exists = False,
data = {
"lat": 55,
"lon": 53

Creating an Event

Events can be created by calling .create() on an event.

test_stream ='test-new-events')
evt = test_stream.Event(id=55, data={'lat': 55, 'lon': 53}, ts=datetime(2018,1,1,3,55))

Updating an Event

Events can be updated by calling .update() on an event that's been modified.['t'] = 100

{'lat': 55, 'lon': 53, 't': 100}

Deleting an Event

Events can be deleted by calling .delete() on an event.


Getting events by "id"

You can get a specific event back by calling .read() and supplying an id.