Skip to main content
Version: Python

has_data_index

has_data_index checks if a table has a DataIndex for the given key column(s).

Syntax

has_data_index(table: Table, key_cols: List[str]) -> bool

Parameters

ParameterTypeDescription
tableTable

The table to check.

key_colsList[str]

The names of the key column(s) indexed.

Returns

A bool indicating whether or not the table has a DataIndex for the given key column(s).

Examples

The following example checks if a table has an index for one or two key columns.

from deephaven.experimental.data_index import data_index, has_data_index
from deephaven import empty_table

source = empty_table(10).update(["Key1 = i % 3", "Key2 = i % 2", "Value = i"])

index = data_index(source, ["Key1"])

print(has_data_index(source, ["Key1"]))
print(has_data_index(source, ["Key1", "Key2"]))