- Index

< Previous |  | Next >

# LiveView Data Tables

The basis of a LiveView project is the LiveView data table. TIBCO LiveView takes your streaming data and lets you view it as a continuously updating table. Data is streamed through LiveView data tables, which are in turn contained within LiveView projects. A single project must have a minimum of one table and may have many more.

## Data Table Overview

LiveView data tables are similar to standard relational database tables in that they consist of table rows and columns. Table columns store simple, scalar data types including numbers, strings, or timestamps, as described in Data Types Supported in LiveView Tables.

A table row is a horizontal record of values that fit into each different table column. However, unlike static SQL tables, LiveView data tables are designed to show continuously updating data received from a data stream.

When you use a project to start LiveView Server, you bring streaming data into a LiveView table via a data stream. A data stream is a series of ordered tuples. LiveView data table configuration requires that the table's input stream is named DataIn.

Every time a table's DataIn stream sends a tuple, a row is published in the LiveView table.

Tables are required to have at least one field designated as a primary key, which identifies the table record. If the table's primary key contains a field or fields for which each entry is unique, the table adds a new row every time a new tuple arrives. If the table's primary key has nonunique entries, then the first arrival of a primary key value creates a new table row and successive arrivals of tuples with the same primary key value update the rows with matching key fields.

### Note

When applying the input tuple, any columns in the table that are missing in the input tuple or are null valued do not overwrite the old column value.

If you need to explicitly write a null value into a column that already has a non-null value, you must delete that row and re-write it, defining all fields that should have non-null values. If you need a value that represents removed or missing data that you can write in one step, choose a non-null value within the allowed values for that data type (such as -10000000 for int, `empty` for string, and so on). Choose a value that is invalid based on the business use of that field and column, and that will not be generated from normal operations.

## Parts of a Data Table lvconf File

The configuration file for a LiveView data table has the following required parts:

- `<liveview-configuration>` declares that this is an lvconf file. These tags contains the following namespace and schema attributes:

      <liveview-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:noNamespaceSchemaLocation="http://www.streambase.com/schemas/lvconf/">

  This top-level element is automatically populated when you create an lvconf file in StreamBase Studio.

- `<data-table>` is the first child of `<liveview-configuration>` and declares that this file configures a data table. A data table receives tuples from a StreamBase data stream and publishes the tuples as rows.

- `<fields>` is a container for one or more `<field>` elements. The `<fields>` element as a whole declares the data table's schema.

- `<field>` is a child of `<fields>`; it defines each field of the data table. The required attributes are `name` and `type`.

  - The field name must start with an alphabetic character (uppercase or lowercase) and may contain underscores and numbers. Field names cannot use any of the LiveView Reserved Words.

  - Field data types must be of one of the supported data types for LiveView tables.

- `<primary-key>` lists the field or fields in the table that make rows unique.

Most LiveView data tables also have the following parts configured:

- `<data-sources>` declares one or more data sources for a table. Data source options are: a LiveView author-time aggregation table or an EventFlow application that feeds data to the LiveView data table, possibly transforming the data in some way first.

- `<indexes>` specifies table fields that are to be indexed. Data table indexes are very useful for improving query performance.

The full list of available elements, attributes, and their descriptions is provided in the LiveView Graphical Configuration Reference.