faust.tables.wrappers

Wrappers for windowed tables.

class faust.tables.wrappers.WindowedKeysView(mapping: faust.types.tables.WindowWrapperT, event: faust.types.events.EventT = None)[source]

The object returned by windowed_table.keys().

now() → Iterator[Any][source]
Return type:Iterator[Any]
current(event: faust.types.events.EventT = None) → Iterator[Any][source]
Return type:Iterator[Any]
delta(d: Union[datetime.timedelta, float, str], event: faust.types.events.EventT = None) → Iterator[Any][source]
Return type:Iterator[Any]
class faust.tables.wrappers.WindowedItemsView(mapping: faust.types.tables.WindowWrapperT, event: faust.types.events.EventT = None)[source]

The object returned by windowed_table.items().

now() → Iterator[Tuple[Any, Any]][source]
Return type:Iterator[Tuple[Any, Any]]
current(event: faust.types.events.EventT = None) → Iterator[Tuple[Any, Any]][source]
Return type:Iterator[Tuple[Any, Any]]
delta(d: Union[datetime.timedelta, float, str], event: faust.types.events.EventT = None) → Iterator[Tuple[Any, Any]][source]
Return type:Iterator[Tuple[Any, Any]]
class faust.tables.wrappers.WindowedValuesView(mapping: faust.types.tables.WindowWrapperT, event: faust.types.events.EventT = None)[source]

The object returned by windowed_table.values().

now() → Iterator[Any][source]
Return type:Iterator[Any]
current(event: faust.types.events.EventT = None) → Iterator[Any][source]
Return type:Iterator[Any]
delta(d: Union[datetime.timedelta, float, str], event: faust.types.events.EventT = None) → Iterator[Any][source]
Return type:Iterator[Any]
class faust.tables.wrappers.WindowSet(key: KT, 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[[VT, VT], VT], value: VT, event: faust.types.events.EventT = None) → faust.types.tables.WindowSetT[KT, VT][source]
Return type:WindowSetT[~KT, ~VT]
value(event: faust.types.events.EventT = None) → VT[source]
Return type:~VT
now() → VT[source]
Return type:~VT
current(event: faust.types.events.EventT = None) → VT[source]
Return type:~VT
delta(d: Union[datetime.timedelta, float, str], event: faust.types.events.EventT = None) → VT[source]
Return type:~VT
class faust.tables.wrappers.WindowWrapper(table: faust.types.tables.TableT, *, relative_to: Union[faust.types.tables._FieldDescriptorT, Callable[Optional[faust.types.events.EventT], Union[float, datetime.datetime]], datetime.datetime, float, None] = None, key_index: bool = False, key_index_table: faust.types.tables.TableT = 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.

ValueType

alias of WindowSet

key_index = False
key_index_table = None
clone(relative_to: Union[faust.types.tables._FieldDescriptorT, Callable[Optional[faust.types.events.EventT], Union[float, datetime.datetime]], datetime.datetime, float, None]) → faust.types.tables.WindowWrapperT[source]
Return type:WindowWrapperT[]
name
Return type:str
relative_to(ts: Union[faust.types.tables._FieldDescriptorT, Callable[Optional[faust.types.events.EventT], Union[float, datetime.datetime]], datetime.datetime, float, None]) → 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[None]]) → Callable[Awaitable[None]][source]
Return type:Callable[[], Awaitable[None]]
on_set_key(key: Any, value: Any) → None[source]
Return type:None
on_del_key(key: Any) → None[source]
Return type:None
keys() → KeysView[source]
Return type:KeysView[~KT]
values(event: faust.types.events.EventT = None) → ValuesView[source]
Return type:ValuesView[+VT_co]
items(event: faust.types.events.EventT = None) → ItemsView[source]
Return type:ItemsView[~KT, +VT_co]
as_ansitable(title: str = '{table.name}', **kwargs) → str[source]
Return type:str
get_relative_timestamp
Return type:Optional[Callable[[Optional[EventT[]]], Union[float, datetime]]]