Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS timestream : Name already exists in dimension for the given multi measure name, or name exists in multi measures for the given dimension name

I am developing an IOT application that is writing to AWS Timestream quite frequently. It is trying to insert the records with different times but still, I am getting the same error. Each record row looks as follows

record = {
'Dimensions': [{'Name': 'id', 'Value': "'123'"}, 
               {'Name': 'kafkaTimestamp', 'Value': "'1657541700943'"}],
'MeasureName': 'Telemetry', 
'MeasureValueType': 'MULTI', 
'MeasureValues': [
                {'Name': 'property', 'Value': 'connection', 'Type': 'VARCHAR'}, 
                {'Name': 'value', 'Value': 'yes', 'Type': 'VARCHAR'}],
'Time': str(int(round(time.time() * 1000)))
}

It has a couple of dimensions which remains the same, but we have different measure values each time.

My understanding is that dimensions, measure name and time make a primary key, so in the code, I am using the latest time every time I am inserting a record into the database but still records are being rejected with the exception.

Name already exists in dimension for the given multi measure name, or name exists in multi measures for the given dimension name

Any thoughts that what could be wrong here with the record schema.

like image 287
Haseeb Asif Avatar asked Oct 31 '25 19:10

Haseeb Asif


1 Answers

This is a poorly documented constraint in Timestream.

You cannot reuse a multi measure name field that is already registered as a dimension or vice versa. Timestream doesn't allow "column name" reuse between dimensions and MVA fields.

This has been added to the naming limits doc:

https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html#limits.naming

like image 189
Dominic Preuss Avatar answered Nov 02 '25 12:11

Dominic Preuss



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!