from <stream-name>
insert into <stream-name> ( {<attribute-name>}| ‘*’|)
Pass-through query creates an output stream according to the projection defined and inserts any events from the input stream to the output stream.
Following projections are available for Siddhi queries
1. All
2. Selected attributes
Following example shows sample queries for different projections with pass-through query.
Stream defined by "define stream StockExchangeStream (symbol string, price int, volume float );" is used in below queries.
All
From all events of the StockExchangeStream stream, output all the events where the output event will have all the input event's attributes.
from StockExchangeStream
insert into StockQuote * ;
or
from StockExchangeStream
insert into StockQuote ;
Here since projection is omitted or ‘*’ is used, we are projecting all the input attributes as the output of the query, and hence the output stream ‘StockQuote’ will only contain ‘symbol’, 'price' and ‘volume’ attributes,
Selected attributes
From all events of the StockExchangeStream stream, output all the events where the output event will only have symbol and volume as its attributes.
from StockExchangeStream
insert into StockQuote symbol, volume
Here we are only projecting ‘symbol’ and ‘volume’ as the output of the query, and hence the output stream ‘StockQuote’ will only contain ‘symbol’ and ‘volume’ attributes.
From all events of the StockExchangeStream stream, output all the events where the output event will only have symbol renamed as companyName and volume as its attributes.
from StockExchangeStream
insert into StockQuote symbol as companyName, volume
Here we are only projecting ‘symbol’ as 'comapanyName' and ‘volume’ as the output of the query, and hence the output stream ‘StockQuote’ will only contain ‘comapanyName’ and ‘volume’ attributes.