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()
.
-
class
faust.tables.wrappers.
WindowedItemsView
(mapping: faust.types.tables.WindowWrapperT, event: faust.types.events.EventT = None)[source]¶ The object returned by
windowed_table.items()
.
-
class
faust.tables.wrappers.
WindowedValuesView
(mapping: faust.types.tables.WindowWrapperT, event: faust.types.events.EventT = None)[source]¶ The object returned by
windowed_table.values()
.
-
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 sincek
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]
-
-
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.-
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
-
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
-
relative_to_field
(field: faust.types.models.FieldDescriptorT) → faust.types.tables.WindowWrapperT[source]¶ - Return type
-
values
(event: faust.types.events.EventT = None) → ValuesView[source]¶ - Return type
ValuesView
[+VT_co]
-