deephaven.table_listener

This module provides utilities for listening to table changes.

class TableListener[source]

Bases: abc.ABC

An abstract table listener class that should be subclassed by any user table listener class.

abstract on_update(update, is_replay)[source]

The required method on a listener object that receives table updates.

Return type

None

class TableListenerHandle(t, listener, description=None)[source]

Bases: object

A handle to manage a table listener’s lifecycle.

start(do_replay=False, replay_lock='shared')[source]

Start the listener by registering it with the table and listening for updates.

Parameters
  • do_replay (bool) – whether to replay the initial snapshot of the table, default is False

  • replay_lock (str) – the lock type used during replay, default is ‘shared’, can also be ‘exclusive’.

Raises

DHError

Return type

None

stop()[source]

Stop the listener by de-registering it from the table and stop listening for updates.

Return type

None

class TableUpdate(table, j_table_update)[source]

Bases: deephaven._wrapper.JObjectWrapper

added(cols=None)[source]

Returns a dict with each key being a column name and each value being a NumPy array of all the added rows in the columns.

Parameters

cols (Union[str, List[str]) – the column(s) for which to return the added rows

Return type

Dict[str, ndarray]

Returns

a dict

added_chunks(chunk_size, cols=None)[source]

Returns a generator that on each iteration, only returns a chunk of added rows in the form of a dict with each key being a column name and each value being a NumPy array of the rows in the chunk.

Parameters
  • chunk_size (int) – the size of the chunk

  • (Union[str (cols) – the columns(s) for which to return the added rows

  • List[str]] – the columns(s) for which to return the added rows

Return type

Generator[Dict[str, ndarray], None, None]

Returns

a generator

j_object_type

alias of io.deephaven.engine.table.TableUpdate

modified(cols=None)[source]

Returns a dict with each key being a column name and each value being a NumPy array of the current values of all the modified rows in the columns.

Parameters

cols (Union[str, List[str]) – the column(s) for which to return the added rows

Return type

Dict[str, ndarray]

Returns

a dict

modified_chunks(chunk_size, cols=None)[source]

Returns a generator that on each iteration, only returns a chunk of modified rows in the form of a dict with each key being a column name and each value being a NumPy array of the current values of the rows in the chunk.

Parameters
  • chunk_size (int) – the size of the chunk

  • (Union[str (cols) – the columns(s) for which to return the added rows

  • List[str]] – the columns(s) for which to return the added rows

Return type

Generator[Dict[str, ndarray], None, None]

Returns

a generator

property modified_columns: List[str]

The list of modified columns in this update.

Return type

List[str]

modified_prev(cols=None)[source]

Returns a dict with each key being a column name and each value being a NumPy array of the previous values of all the modified rows in the columns.

Parameters

cols (Union[str, List[str]) – the column(s) for which to return the added rows

Return type

Dict[str, ndarray]

Returns

a dict

modified_prev_chunks(chunk_size, cols=None)[source]

Returns a generator that on each iteration, only returns a chunk of modified rows in the form of a dict with each key being a column name and each value being a NumPy array of the previous values of the rows in the chunk.

Parameters
  • chunk_size (int) – the size of the chunk

  • (Union[str (cols) – the columns(s) for which to return the added rows

  • List[str]] – the columns(s) for which to return the added rows

Return type

Generator[Dict[str, ndarray], None, None]

Returns

a generator

removed(cols=None)[source]

Returns a dict with each key being a column name and each value being a NumPy array of all the removed rows in the columns.

Parameters

cols (Union[str, List[str]) – the column(s) for which to return the added rows

Return type

Dict[str, ndarray]

Returns

a dict

removed_chunks(chunk_size, cols=None)[source]

Returns a generator that on each iteration, only returns a chunk of removed rows in the form of a dict with each key being a column name and each value being a NumPy array of the rows in the chunk.

Parameters
  • chunk_size (int) – the size of the chunk

  • (Union[str (cols) – the columns(s) for which to return the added rows

  • List[str]] – the columns(s) for which to return the added rows

Return type

Generator[Dict[str, ndarray], None, None]

Returns

a generator

listen(t, listener, description=None, do_replay=False, replay_lock='shared')[source]

This is a convenience function that creates a TableListenerHandle object and immediately starts it to listen for table updates.

The function returns the created TableListenerHandle object whose ‘stop’ method can be called to stop listening. If it goes out of scope and is garbage collected, the listener will stop receiving any table updates.

Parameters
  • t (Table) – table to listen to

  • listener (Union[Callable, TableListener]) – listener for table changes

  • description (str, optional) – description for the UpdatePerformanceTracker to append to the listener’s entry description, default is None

  • do_replay (bool) – whether to replay the initial snapshot of the table, default is False

  • replay_lock (str) – the lock type used during replay, default is ‘shared’, can also be ‘exclusive’

Returns

a TableListenerHandle

Raises

DHError