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
Parameter | Type | Description |
---|---|---|
init_table | Table | The table from which the input table will be created. If used, column definitions must be |
col_defs | dict[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 |
key_cols | list[str] | One or more key column names. The default value is |
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.add_async
: add data to an input table asynchronously. The added data must fit the schema of the input table.delete
: delete data from an input table. This method can only be used on a keyed input table.delete_async
: delete data from an input table asynchronously. This method can only be used on a keyed 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)
- source
- result
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)
- my_table
- my_input_table
Data can be added to an input table manually via the UI.