How to log to a table from a Persistent Query

This guide shows how to log to a table from a query. In the examples below, the queries will be logging to the MarketData.Trades table. The schema is:

A Deephaven Table with an equivalent TableDefinition can be appended to a System table using the SystemTableLogger. Rows can be appended automatically from an updating Table with SystemTableLogger.logTableIncremental(...) or on-demand with SystemTableLogger.logTable(...), both shown below. Both logging operations support advanced logging configurations. In Groovy, this is done with the SystemTableLogger.Options builder. In Python, these configuration parameters are passed in as named arguments.

Note

Unlike the old Legacy Logger, there is no direct Logger.log(Row.Flags, ...) method provided to allow logging of individual values to a row. This functionality can be simulated by creating a new temporary Table with the appropriate values in a single row and logging the table with SystemTableLogger.logTable(...).

Logging data from a static table

A Table can be written using SystemTableLogger.logTable(...). This may be called as many times as desired. Be aware that each call to SystemTableLogger.logTable(...) will log the entire Table that is passed in, so care must be taken to avoid duplication.

Logging data from an updating table

A Table can be written on a live basis using SystemTableLogger.logTableIncremental(...). The Table used as the source to this call must be an append-only Table. Rows cannot be removed or modified in the Table. As with the static writer, each call to SystemTableLogger.logTableIncremental(...) will log the entire Table, so care must be taken to avoid duplication if there are multiple calls.