deephaven.table_factory

This module provides various ways to make a Deephaven table.

class DynamicTableWriter(col_defs)[source]

Bases: deephaven._wrapper.JObjectWrapper

The DynamicTableWriter creates a new in-memory table and supports writing data to it.

This class implements the context manager protocol and thus can be used in with statements.

close()[source]

Closes the writer.

Raises

DHError

Return type

None

j_object_type

alias of io.deephaven.engine.table.impl.util.DynamicTableWriter

write_row(*values)[source]

Writes a row to the newly created table.

The type of a value must be convertible (safely or unsafely, e.g. lose precision, overflow, etc.) to the type of the corresponding column.

Parameters

*values (Any) – the values of the new row, the data types of these values must match the column definitions of the table

Raises

DHError

Return type

None

empty_table(size)[source]

Creates a table with rows but no columns.

Parameters

size (int) – the number of rows

Return type

Table

Returns

a Table

Raises

DHError

merge(tables)[source]

Combines two or more tables into one aggregate table. This essentially appends the tables one on top of the other. Null tables are ignored.

Parameters

tables (List[Table]) – the source tables

Returns

a Table

Raises

DHError

merge_sorted(tables, order_by)[source]

Combines two or more tables into one sorted, aggregate table. This essentially stacks the tables one on top of the other and sorts the result. Null tables are ignored. mergeSorted is more efficient than using merge followed by sort.

Parameters
  • tables (List[Table]) – the source tables

  • order_by (str) – the name of the key column

Return type

Table

Returns

a Table

Raises

DHError

new_table(cols)[source]

Creates an in-memory table from a list of input columns. Each column must have an equal number of elements.

Parameters

cols (List[InputColumn]) – a list of InputColumn

Return type

Table

Returns

a Table

Raises

DHError

time_table(period, start_time=None)[source]

Creates a table that adds a new row on a regular interval.

Parameters
  • period (Union[str, int]) – time interval between new row additions, can be expressed as an integer in nanoseconds or a time interval string, e.g. “00:00:00.001”

  • start_time (str) – start time for adding new rows

Return type

Table

Returns

a Table

Raises

DHError