deephaven_enterprise.remote_table¶
This module provides a simple interface for creating subscriptions to remote tables in Deephaven via the Barrage protocol.
Specifically, use the methods in this module to create reliable connections to remote Barrage tables. The tables gracefully handle disconnection and reconnect when the upstream is available.
To establish a subscription begin with in_local_cluster() and specify the name of the Persistent Query and the table name to subscribe to. You can then call subscribe() or snapshot() on the result to fetch a live subscription or a static snapshot.
If you do not provide the prototype table definition, the query must be available and running to do the subscription or snapshot.
For example:
import deephaven_enterprise.remote_table ticking_remote_table = remote_table.in_local_cluster(query_name=”TestQuery”, table_name=”TestTable”) .subscribe(included_columns=[“Col1”, “Col3”, “Col5”])
- class RemoteTableBuilder(j_builder)[source]¶
Bases:
objectRemoteTableBuilder is used to create a subscription to a remote table or fetch a snapshot fo a remote table.
- blink(is_blink)[source]¶
Sets whether the remote table must be a blink table. If the table is not a blink table, the subscription will fail.
- Parameters:
is_blink (bool) – true if the table is a blink table
- Returns:
self
- query_name(query_name)[source]¶
Sets the name of the query to fetch the table from.
- Parameters:
query_name (str) – the query name
- Returns:
self
- snapshot(included_columns=None)[source]¶
Creates a static snapshot of the remote table for the specified columns, or all if none are specified
- subscribe(clear_on_disconnect=None, retry_window_millis=None, max_retries_within_window=None, included_columns=None, filters=None)[source]¶
Subscribes to the remote table.
- Parameters:
clear_on_disconnect (bool) – if the result table should clear its rows on a disconnection. Defaults to True
retry_window_millis (int) – the window size in milliseconds to attempt to reconnect, defaults to None, which means 60 seconds
max_retries_within_window (int) – the maximum allowable number of unsuccessful retries in the retry window, defaults to None, which means 5 retries.
included_columns (list[str]) – the set of columns to include in the subscription, defaults to None, which includes all columns
filters (list[str]) – a list of raw string filters to apply before subscription, defaults to None
- Returns:
the subscribed table
- Return type:
Table
- table_definition(table_definition)[source]¶
Sets the prototype table definition of the table to fetch. If this is not specified, the definition will be discovered by connecting to the query, which requires it to be available.
- Parameters:
table_definition (JTableDefinition) – the prototype table definition
- Returns:
self
- class UnauthenticatedRemoteTableBuilder(cluster_url)[source]¶
Bases:
objectUnauthenticatedRemoteTableBuilder is used to authenticate with a remote cluster before subscribing to a table.
- password(user_name, password)[source]¶
Authenticates with the cluster using a username and password
- Parameters:
- Return type:
- Returns:
RemoteTableBuilder
- Raises:
DHError –
- for_remote_cluster(cluster_url)[source]¶
Creates a new unauthenticated remote table builder for a remote cluster identified by the provided URL.
The builder is unauthenticated and requires a call to
UnauthenticatedRemoteTableBuilder.password()orUnauthenticatedRemoteTableBuilder.private_key()to authenticate and get an authenticatedRemoteTableBuilderin order to subscribe to a remote table or fetch a snapshot of a remote table.- Parameters:
cluster_url (str) – the URL of the remote cluster
- Return type:
- Returns:
UnauthenticatedRemoteTableBuilder