Create a table with time_table
This guide will show you how to create a time table. A time table is a special type of table that adds new rows at a regular, user-defined interval. Its sole column is a timestamp column.
Here, we will make a simple time table that ticks every two seconds. We are using the time_table
method. Its sole argument specifies the interval at which the table ticks as a duration string.
Copy and run the following code in your console:
from deephaven import time_table
result = time_table("PT2S")
This produces a table with one column (Timestamp
) that appends a new row every two seconds. PT
is the prefix to indicate a duration.
The example above creates an append-only time table. To create a blink time table, which only retains rows from the most recent update cycle, set the blink_table
parameter to True
:
from deephaven import time_table
result = time_table("PT00:00:02", blink_table=True)
This time table updates every two seconds, but only keeps the row received during the last update cycle:
Time tables are often used as trigger tables, which, through the use of snapshot_when
can:
- reduce the update frequency of ticking tables
- create the history of a table, sampled at a regular interval