CREATE [PUBLIC] INPUT STREAM
anonymous_schema[ WITH PARAMETERS (
parameter_value" [, ...] )];
A unique identifier (name) for the input stream.
The identifier of a previously-defined named schema. Imports all of the named schema's fields. No parentheses are required, and no other fields are permitted. Named schemas must be defined in dependency order. If a schema is used before it is defined, an error results.
A schema definition, delimited by parentheses, in the following format:
A field definition takes the form:
A unique name for a field in the schema associated with the stream. For table indexes, if the field references a named schema, the entire schema is used as the key.
One of the supported StreamBase data types.
A parameter takes the form:
The name of a StreamBase parameter appropriate to the statement
A quoted value for the parameter, which if a string must include escaped quotes
The following statements create a named schema and reference it in an input stream:
CREATE SCHEMA SymbolSchema (ID int, Symbol string, Price double); CREATE INPUT STREAM Input1 SymbolSchema;
The input stream statement above is equivalent to the following, using an anonymous schema:
CREATE INPUT STREAM Input1 (ID int, Symbol string, Price double);
The next two input statements use anonymous schemas:
CREATE INPUT STREAM Input2 (ID int, Symbol string, Price double); CREATE INPUT STREAM Input3 (ss SymbolSchema, Quantity int);
The second anonymous schema combines a reference to the named schema shown earlier with another field. It is equivalent to:
ss (ID int, Symbol string, Price double), Quantity int
The CREATE INPUT STREAM statement defines an Input Stream. The types and order of fields contained in the incoming tuples must either be defined in an anonymous schema, or referenced from a previously defined named schema.
To use a named schema, simply provide its name. To use an anonymous schema, declare a comma-separated list of fields, specifying the identifier and data type of each, and enclose the schema in parentheses.
You must define a schema. For example, the statement CREATE INPUT STREAM () will result in a runtime error.
Use the optional PUBLIC keyword to designate that this stream is to be available for enqueuing, no matter how deeply the module that contains this stream is nested in a complex application.
To create streams with schemas that cannot be overridden, precede CREATE INPUT STREAM with a USING HYGIENIC statement. For example:
USING HYGIENIC; CREATE INPUT STREAM TradesIn ( symbol string, – Stock symbol quantity int – Number of shares ); ...
When this module is called, the schema of tuples it receives must exactly match the schema declared above. If you convert an EventFlow module to StreamSQL, you can achieve this by first clearing the Hygienic Modules.check box on the Annotations tab. For more information, see