faust.tables.wrappers

Wrappers for windowed tables.

class faust.tables.wrappers.WindowSet(key: Any, table: faust.types.tables.TableT, wrapper: faust.types.tables.WindowWrapperT, event: faust.types.events.EventT = None) → None[source]

Represents the windows available for table key.

Table[k] returns WindowSet since k can exist in multiple windows, and to retrieve an actual item we need a timestamp.

The timestamp of the current event (if this is executing in a stream processor), can be used by accessing .current():

Table[k].current()

similarly the most recent value can be accessed using .now():

Table[k].now()

from delta of the time of the current event:

Table[k].delta(timedelta(hours=3))

or delta from time of other event:

Table[k].delta(timedelta(hours=3), other_event)
apply(op: Callable[[Any, Any], Any], value: Any, event: faust.types.events.EventT = None) → faust.types.tables.WindowSetT[source]
Return type:WindowSetT[]
value(event: faust.types.events.EventT = None) → Any[source]
Return type:Any
now() → Any[source]
Return type:Any
current(event: faust.types.events.EventT = None) → Any[source]
Return type:Any
delta(d: Union[datetime.timedelta, float, str], event: faust.types.events.EventT = None) → Any[source]
Return type:Any
class faust.tables.wrappers.WindowWrapper(table: faust.types.tables.TableT, *, relative_to: Union[faust.types.tables.FieldDescriptorT, typing.Callable[[typing.Union[faust.types.events.EventT, NoneType]], typing.Union[float, datetime.datetime]], datetime.datetime, float, NoneType] = None) → None[source]

Windowed table wrapper.

A windowed table does not return concrete values when keys are accessed, instead WindowSet is returned so that the values can be further reduced to the wanted time period.

clone(relative_to: Union[faust.types.tables.FieldDescriptorT, typing.Callable[[typing.Union[faust.types.events.EventT, NoneType]], typing.Union[float, datetime.datetime]], datetime.datetime, float, NoneType]) → faust.types.tables.WindowWrapperT[source]
Return type:WindowWrapperT[]
name
relative_to(ts: Union[faust.types.tables.FieldDescriptorT, typing.Callable[[typing.Union[faust.types.events.EventT, NoneType]], typing.Union[float, datetime.datetime]], datetime.datetime, float, NoneType]) → faust.types.tables.WindowWrapperT[source]
Return type:WindowWrapperT[]
relative_to_now() → faust.types.tables.WindowWrapperT[source]
Return type:WindowWrapperT[]
relative_to_field(field: faust.types.models.FieldDescriptorT) → faust.types.tables.WindowWrapperT[source]
Return type:WindowWrapperT[]
relative_to_stream() → faust.types.tables.WindowWrapperT[source]
Return type:WindowWrapperT[]
get_timestamp(event: faust.types.events.EventT = None) → float[source]
Return type:float
on_recover(fun: Callable[Awaitable[NoneType]]) → Callable[Awaitable[NoneType]][source]
Return type:Callable[[], Awaitable[None]]
get_relative_timestamp