Schemas

A schema defines the structure of data rows in a stream or window.

Every row in a stream or window must have the same structure, or schema, which includes the column names, the column datatypes, and the order in which the columns appear. Multiple streams or windows may use the same schema, but a stream or window can only have one schema.

Create a schema using the CREATE SCHEMA statement and associate it with a particular stream or window. You can create inline schemas within the syntax you use to create streams and windows, or create a named schema separately to reference later.

Simple Schema CCL Example

This is an example of a CREATE SCHEMA statement used to create a named schema. TradeSchema represents the name of the schema.

CREATE SCHEMA TradeSchema (
		Ts BIGDATETIME, 
		Symbol STRING, 
		Price MONEY(4), 
		Volume INTEGER
);

This example uses a CREATE SCHEMA statement to make an inline schema:

CREATE STREAM trades SCHEMA (
		Ts bigdatetime, 
		Symbol STRING, 
		Price MONEY(4), 
		Volume INTEGER
);
Related reference
CREATE SCHEMA Statement