deephaven.stream.table_publisher

The table_publisher module supports publishing Deephaven Tables into blink Tables.

class TablePublisher(j_table_publisher)[source]

Bases: JObjectWrapper

The interface for publishing table data into a blink table.

add(table)[source]

Adds a snapshot of the data from table into the blink table. The table must contain a superset of the columns from the blink table’s definition; the columns may be in any order. Columns from table that are not in the blink table’s definition are ignored.

All of the data from table will be:

  1. consistent with a point in time

  2. fully contained in a single blink table’s update cycle

  3. non-interleaved with any other calls to add (concurrent, or not)

Parameters:

table (Table) – the table to add

Return type:

None

property is_alive

Checks whether this is alive; if False, the caller should stop adding new data and release any related resources as soon as practicable since adding new data won’t have any downstream effects.

Once this is False, it will always remain False. For more prompt notifications, callers may prefer to use on_shutdown_callback during construction.

Returns:

if this publisher is alive

j_object_type

alias of TablePublisher

publish_failure(failure)[source]

Indicate that data publication has failed. Blink table listeners will be notified of the failure, the on-shutdown callback will be invoked if it hasn’t already been, this publisher will no longer be alive, and future calls to add will silently return without publishing. These effects may resolve asynchronously.

Parameters:

failure (Exception) – the failure

Return type:

None

table_publisher(name, col_defs, on_flush_callback=None, on_shutdown_callback=None, update_graph=None, chunk_size=2048)[source]

Constructs a blink Table and TablePublisher to populate it.

Parameters:
  • name (str) – the name, used for logging

  • col_defs (Dict[str, DType]) – the column definitions for the resulting blink table

  • on_flush_callback (Optional[Callable[[TablePublisher], None]]) – the on-flush callback, if present, is called once at the beginning of each update graph cycle. This is a pattern that allows publishers to add any data they may have been batching. Do note though, this blocks the update cycle from proceeding, so implementations should take care to not do extraneous work.

  • on_shutdown_callback (Optional[Callable[[], None]]) – the on-shutdown callback, if present, is called one time when the caller should stop adding new data and release any related resources as soon as practicable since adding data won’t have any downstream effects

  • update_graph (Optional[UpdateGraph]) – the update graph the resulting table will belong to. If unset, the update graph of the current execution context will be used.

  • chunk_size (int) – the chunk size, the size at which chunks will be filled from the source table during an add, defaults to 2048

Return type:

Tuple[Table, TablePublisher]

Returns:

a two-tuple, where the first item is resulting blink Table and the second item is the TablePublisher