deephaven.experimental.data_index

This module provides the ability to create, check, and retrieve DataIndex objects from Deephaven tables.

class DataIndex(j_data_index)[source]

Bases: JObjectWrapper

A DataIndex is an index used to improve the speed of data access operations for a Deephaven table. The index applies to one or more indexed (key) column(s) of a Deephaven table.

Note that a DataIndex itself is backed by a table.

j_object_type

alias of DataIndex

property keys

The names of the columns indexed by the DataIndex.

property table

The backing table of the DataIndex.

data_index(table, key_cols, create_if_absent=True)[source]

Gets the DataIndex for the given key columns on the provided table. When the DataIndex already exists, returns it. When the DataIndex doesn’t already exist, if create_if_absent is True, creates the DataIndex first then returns it; otherwise returns None.

Parameters:
  • table (Table) – the table to index

  • key_cols (List[str]) – the names of the key columns to index

  • create_if_absent (bool) – if True, create the DataIndex if it does not already exist, default is True

Return type:

Optional[DataIndex]

Returns:

a DataIndex or None

Raises:

DHError

has_data_index(table, key_cols)[source]

Checks if a table currently has a DataIndex for the given key columns.

Parameters:
  • table (Table) – the table to check

  • key_cols (List[str]) – the names of the key columns indexed

Returns:

True if the table has a DataIndex, False otherwise

Return type:

bool