如何使用WSO2 CEP和Siddhi查询语言进行UPSERT操作



我有一个 username,ipaddress,timestamp

的用户流

我想将此详细信息存储在UserDetailsTable(在内存表中)中,需要做 UPSERT 。如果用户名和iPaddress相同并插入新行,我该如何更新行。

例如:

Ist userStream is "Rockey","192.15.12.11","10-10-2015 10.32"
2nd userStream is "Jose","192.15.12.21","10-10-2015 10.33"
3rd userStream is "Rockey","192.15.12.11","10-10-2015 10.34"

UserDetailstable的结果在

以下
"Jose","192.15.12.21","10-10-2015 10.33"   (New row)
"Rockey","192.15.12.11","10-10-2015 10.34" (Update the existing row)

您可以使用以下方法。

from userStream
select username, ipaddress ,timestamp
update UserDetailsTable
on UserDetailsTable.username == username

请不要使用流属性和事件表属性相同。希望这会有所帮助。

谢谢。

最新更新