Upsert additional measure values to an existing multi measure record

0

I have a use case where I receive measures relating to the same dimension/timestamp at different times. I've previously been storing these as discrete records, but I'd prefer to have the initial record supplemented with the additional values.

For example, my data source produces records that looks like device, timestamp, sensorId, metric and I'd like to represent this in timestream as:

device, timestamp, S1metric, S2metric, S3metric

NB: The sensorId's are in the range 1-3.

This means creating a partial record and updating the values over time as new data is received for the same dimensions.

When I receive the first data point, the record would be

<device>, <timestamp>, S1metric=<s1value>

When I receive the second data point, the record would be written as

<device>, <timestamp>, S1metric=<s2value>

And I want the stored record to look like:

<device>, <timestamp>, S1metric=<s1value>, s2metric=<s2value>

If I do an upsert with a Version set to Date.now() (Javascript) then the second record completely replaces the first, as opposed to adding the new value where there was previously NULL. I do not specify NULL for the missing values in the write request, I simply specify the measure value for the sensor I'm currently handling. I was hoping that TS would use the already stored value for the values not specified in the write request, but the update seems to be processed as a whole record (which I can provide without first querying the existing record).

Is there a way to acheive what I'm trying to do?

已提问 1 年前90 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则