Skip to main content
Version: Python

input_table

The input_table method creates an input table, which allows users to manually add data via the UI or programmatically via queries.

Syntax

input_table = input_table(
init_table: Table,
col_defs: dict[str, DType] = None,
key_cols: list[str],
) -> InputTable

Parameters

ParameterTypeDescription
init_tableTable

The table from which the input table will be created. If used, column definitions must be None (the default value).

col_defsdict[str, DType]

A set of column definitions that define the column names and types in the input table. If used, an initial table must be None (the default value).

key_colslist[str]

One or more key column names. The default value is None, which results in an append-only input table. If not None, it becomes a keyed input table, which allows for the creation and modification of pre-existing cells.

Returns

An InputTable, a subclass of a Deephaven table in which data can be manually entered by clicking on cells and typing values.

Methods

An input table supports the following methods:

  • add: add data to an input table. The added data must fit the schema of the input table.

Examples

The following example creates an input table from a pre-existing table by using the init_table argument. It does not specify any key columns, which means the result table is append-only.

from deephaven import empty_table, input_table

source = empty_table(10).update(["X = i"])

result = input_table(init_table=source)

The following example creates an input table from a dict of column definitions. It does not specify any key columns, which means the result table is append-only.

from deephaven import input_table
from deephaven import dtypes as dht

my_column_defs = {
"StringCol": dht.string,
"DoubleCol": dht.double
}

my_input_table = input_table(col_defs=my_column_defs)

The third example creates an input table and specifies a key column, so the resulting input table is keyed rather than append-only.

from deephaven import input_table
from deephaven import dtypes as dht

my_column_defs = {
"StringCol": dht.string,
"DoubleCol": dht.double
}

my_input_table = input_table(col_defs=my_column_defs, key_cols="StringCol")

Data can be added to an input table programmatically using the add method.

from deephaven import empty_table, input_table
from deephaven import dtypes as dht

my_col_defs = {
"X": dht.int32,
"Y": dht.double
}
my_table = empty_table(5).update(["X = i", "Y = (double)(2 * i)"])
my_input_table = input_table(col_defs=my_col_defs)
my_input_table.add(my_table)

Data can be added to an input table manually via the UI.

img

img