deephaven.table_listener¶
This module provides utilities for listening to table changes.
- class TableListener[source]¶
Bases:
ABC
An abstract table listener class that should be subclassed by any user table listener class.
- class TableListenerHandle(t, listener, description=None)[source]¶
Bases:
JObjectWrapper
A handle to manage a table listener’s lifecycle.
- j_object_type¶
alias of
PythonReplayListenerAdapter
- 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
- class TableUpdate(table, j_table_update)[source]¶
Bases:
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
cols (Union[str, 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
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
cols (Union[str, 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¶
The list of modified columns in this update.
- 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
cols (Union[str, 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
cols (Union[str, 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 –