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?

asked a year ago84 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions