faust.tables.base

Base class Collection for Table and future data structures.

class faust.tables.base.Collection(app: faust.types.app.AppT, *, name: str = None, default: Callable[Any] = None, store: Union[str, yarl.URL] = None, schema: faust.types.serializers.SchemaT = None, key_type: Union[Type[faust.types.models.ModelT], Type[bytes], Type[str]] = None, value_type: Union[Type[faust.types.models.ModelT], Type[bytes], Type[str]] = None, partitions: int = None, window: faust.types.windows.WindowT = None, changelog_topic: faust.types.topics.TopicT = None, help: str = None, on_recover: Callable[Awaitable[None]] = None, on_changelog_event: Callable[faust.types.events.EventT, Awaitable[None]] = None, recovery_buffer_size: int = 1000, standby_buffer_size: int = None, extra_topic_configs: Mapping[str, Any] = None, recover_callbacks: Set[Callable[Awaitable[None]]] = None, options: Mapping[str, Any] = None, use_partitioner: bool = False, on_window_close: Callable[[Any, Any], None] = None, **kwargs: Any) → None[source]

Base class for changelog-backed data structures stored in Kafka.

property data

Underlying table storage.

async on_start() → None[source]

Call when table starts.

Return type

None

on_recover(fun: Callable[Awaitable[None]]) → Callable[Awaitable[None]][source]

Add function as callback to be called on table recovery.

Return type

Callable[[], Awaitable[None]]

info() → Mapping[str, Any][source]

Return table attributes as dictionary.

Return type

Mapping[str, Any]

persisted_offset(tp: faust.types.tuples.TP) → Optional[int][source]

Return the last persisted offset for topic partition.

Return type

Optional[int]

async need_active_standby_for(tp: faust.types.tuples.TP) → bool[source]

Return False if we have access to partition data.

Return type

bool

reset_state() → None[source]

Reset local state.

Return type

None

send_changelog(partition: Optional[int], key: Any, value: Any, key_serializer: Union[faust.types.codecs.CodecT, str, None] = None, value_serializer: Union[faust.types.codecs.CodecT, str, None] = None) → faust.types.tuples.FutureMessage[source]

Send modification event to changelog topic.

Return type

FutureMessage[]

partition_for_key(key: Any) → Optional[int][source]

Return partition number for table key. c

Note:

If use_partitioner is enabled this always returns None.

Returns:
Optional[int]: specific partition or None if

the producer should select partition using its partitioner.

Return type

Optional[int]

on_window_close(key: Any, value: Any) → None[source]
Return type

None

join(*fields: faust.types.models.FieldDescriptorT) → faust.types.streams.StreamT[source]

Right join of this table and another stream/table.

Return type

StreamT[+T_co]

left_join(*fields: faust.types.models.FieldDescriptorT) → faust.types.streams.StreamT[source]

Left join of this table and another stream/table.

Return type

StreamT[+T_co]

inner_join(*fields: faust.types.models.FieldDescriptorT) → faust.types.streams.StreamT[source]

Inner join of this table and another stream/table.

Return type

StreamT[+T_co]

outer_join(*fields: faust.types.models.FieldDescriptorT) → faust.types.streams.StreamT[source]

Outer join of this table and another stream/table.

Return type

StreamT[+T_co]

clone(**kwargs: Any) → Any[source]

Clone table instance.

Return type

Any

combine(*nodes: faust.types.streams.JoinableT, **kwargs: Any) → faust.types.streams.StreamT[source]

Combine tables and streams.

Return type

StreamT[+T_co]

contribute_to_stream(active: faust.types.streams.StreamT) → None[source]

Contribute table to stream join.

Return type

None

async remove_from_stream(stream: faust.types.streams.StreamT) → None[source]

Remove table from stream join after stream stopped.

Return type

None

async on_rebalance(assigned: Set[faust.types.tuples.TP], revoked: Set[faust.types.tuples.TP], newly_assigned: Set[faust.types.tuples.TP]) → None[source]

Call when cluster is rebalancing.

Return type

None

async on_recovery_completed(active_tps: Set[faust.types.tuples.TP], standby_tps: Set[faust.types.tuples.TP]) → None[source]

Call when recovery has completed after rebalancing.

Return type

None

async call_recover_callbacks() → None[source]

Call any configured recovery callbacks after rebalancing.

Return type

None

async on_changelog_event(event: faust.types.events.EventT) → None[source]

Call when a new changelog event is received.

Return type

None

property label

Return human-readable label used to represent this table. :rtype: str

property shortlabel

Return short label used to represent this table in logs. :rtype: str

property changelog_topic

Return the changelog topic used by this table. :rtype: TopicT[]

logger = <Logger faust.tables.base (WARNING)>
property changelog_topic_name
Return type

str

apply_changelog_batch(batch: Iterable[faust.types.events.EventT]) → None[source]

Apply batch of events from changelog topic local table storage.

Return type

None