EXPORT TABLE

Documentation

Home » Documentation » Using VoltDB

EXPORT TABLE

EXPORT TABLE — Specifies that a table is for export only.

Synopsis

EXPORT TABLE table-name

Description

At runtime, any records written to an export-only table are queued to the export connector, as described in Chapter 13, Exporting Live Data. If export is enabled, this data is then passed to the export connector that manages the export process.

The EXPORT TABLE statement lets you specify which tables in the schema are export-only tables. These tables become write-only. That is, they can be used in INSERT statements, but not SELECT, UPDATE, or DELETE statements.

If export is not enabled at runtime, writing to export-only tables has no effect.

Example

The following example defines two tables — User and User_Export — with similar columns. The second table is then defined as an export table. By inserting into the User_Export table every time a row is inserted into the User table, an automated list of users can be maintained external to the active VoltDB database.

CREATE TABLE User (
   UserID VARCHAR(15) NOT NULL,
   EmailAddress VARCHAR(128) NOT NULL,
   Created TIMESTAMP,
   Password VARCHAR(14),
   LastLogin TIMESTAMP);

CREATE TABLE User_Export (
   UserID BIGINT NOT NULL,
   EmailAddress VARCHAR(128) NOT NULL,
   Created TIMESTAMP);

EXPORT TABLE User_Export;