To execute update only for the specified output event category instead of "update <table name> on <condition>" code snippet use "update <table name> for <output event category> on <condition>", where "<output event category>" could be "current events", "expired events" or "all events" keywords.
Query for insert or overwrite events on event table can be written using an insert-overwrite query having following syntax
from <input stream name> select <attribute name> as <table attribute name>, <attribute name> as <table attribute name>, ... insert overwrite <table name> on <condition>
Here the "on <condition>" can be used to select the events for update or insert, and when writing this condition attribute names of the event tables should be always referred with table name and attributes of the select should not be have reference associated with them.
With "<table attribute name>" the attributes could be referred with the same name thats defined in event table, allowing Siddhi to identify which attributes need to be updated/inserted on event table.
E.g. For each room denoted by its number, update the room types of the RoomTypeTable based on the event sin UpdateStream or insert if it is not exist.
define table RoomTypeTable (roomNo int, type string); define stream UpdateStream (roomNumber int, roomType string); from UpdateStream select roomNumber as roomNo, roomType as type insert overwrite RoomTypeTable on RoomTypeTable.roomNo == roomNo;
Query for checking whether an attribute is in event table can be checked using conditions having the following syntax