Hello,
we have some sensors that send multiple variables (temp, humidity, pressure) through the IoT core writing them to timestream and dynamoDB at the same time using an IoT rule (SQL 2016-03-23).
We are having some problems with rejected values when trying to write those values. Cloudwatch says:
"failedAction": "TimestreamAction",
"errorMessage": "Failed to write records to Timestream. The error received was 'One or more records have been rejected. See RejectedRecords for details. (Service: AmazonTimestreamWrite; Status Code: 419; Error Code: RejectedRecordsException; Request ID: xxx; Proxy: null), Rejected records: [{RecordIndex: 9,
Reason: Measure name already has an assigned measure value type. Each measure name can have only one measure value type and cannot be changed.,}]'. Message arrived on mit/decoded, Action: timestream, Database: sensordata-timestream-db, Table: mit-timestream-table"
The natural type of the values is double
and the first write in timestream defined that measurement with the correct type.
The problem relies when some of the measurements are with decimal part equal to zero (which can be interpreted as an int
), for example 13.0
. In this case Timestream detects it as an int
instead of double
and rejects the measurement.
Reading the documentation and different questions here in re:Post, I saw that a possible solution is to cast the variable as double, but seems not be working. This is how we are casting it:
SELECT
cast(event.payload_sensordata.Hum_SHT as double) as Hum_SHT
....
FROM ....
Another way we have tested without luck is casting as DECIMAL
instead of double
.
This is what we are seeing in both tables:
Any thoughts on how to solve this within the IoT rule?
Thanks!
Good stuff! And if you really want to thank me, please do consider Accepting my answer so I get my precious 10 points. :-)