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: object

RemoteTableBuilder is used to create a subscription to a remote table or fetch a snapshot fo a remote table.

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

Parameters:

included_columns (list[str]) – the columns to include, defaults to None, which includes all columns

Returns:

the snapshot of the table

Return type:

Table

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

table_name(table_name)[source]

Sets the table name to fetch from the query.

Parameters:

table_name (str) – the table name

Returns:

self

class UnauthenticatedRemoteTableBuilder(cluster_url)[source]

Bases: object

UnauthenticatedRemoteTableBuilder 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:
  • user_name (str) – the username

  • password (str) – the password

Return type:

RemoteTableBuilder

Returns:

RemoteTableBuilder

Raises:

DHError

private_key(private_key_file)[source]

Authenticates to the cluster using a private key file.

Parameters:

private_key_file (str) – the private key file

Return type:

RemoteTableBuilder

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() or UnauthenticatedRemoteTableBuilder.private_key() to authenticate and get an authenticated RemoteTableBuilder in 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:

UnauthenticatedRemoteTableBuilder

Returns:

UnauthenticatedRemoteTableBuilder

in_local_cluster(query_name, table_name, table_definition=None)[source]

Creates a new remote table builder for the current cluster. If no table definition is provided, the query must be available for connections.

Parameters:
  • query_name (str) – the name of the Persistent Query to fetch the table from

  • table_name (str) – the table name

  • table_definition (JTableDefinition) – the expected table definition, defaults to None

Return type:

RemoteTableBuilder

Returns:

RemoteTableBuilder