[英]How to update values in cosmos db using azure stream analytics query language?
I'm looking to update data using azures stream analytics query lanuage, for example, at the first event, my data will be like below, 我希望使用azures流分析查询语言更新数据,例如,在第一次事件中,我的数据如下所示,
{
'Name':'product1',
'sales':100
}
at the second event 在第二场比赛
{
'name':'product1'
'sales':200
}
and I wanna sum sales for both of the event, for example, 我想总结两个事件的销售额
{
'name':'product1',
'sales':200
}
I take this case as an extension of this case: How to update values in cosmosdb as output using azure stream analutics? 我将这种情况作为这种情况的扩展: 如何使用Azure流分析将cosmosdb中的值更新为输出? to the words i mentioned before, ASA supports upserts feature for cosmos db if your data contains a unique document id.
用我之前提到的话来说,如果您的数据包含唯一的文档ID,则ASA支持cosmos db的upserts功能。 For you, if your
Name
property is unique key, it could be applied. 对您来说,如果您的
Name
属性是唯一键,则可以应用它。
However,you wanna sum
function now, Azure Function output in ASA could be applied.You could pass the unique Name
and the sales
as params into Azure Function,then query the data with unique Name
and do the sum calculate.Finally,update the data by the unique Name
. 但是,您现在想要求
sum
函数,可以应用ASA中的Azure函数输出 。您可以将唯一的Name
和sales
作为参数传递给Azure Function,然后使用唯一的Name
查询数据并进行总和计算。最后,更新数据通过唯一的Name
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.