Unable to filter query results in web console

0

Hi,

I used the following tutorial to set up a dynamoDB that is populated by an IoT rule. https://docs.aws.amazon.com/iot/latest/developerguide/iot-ddb-rule.html

I can see the data that has been inserted using the DynamoDB Explore Items interface in the AWS console. I would now like to use the Scan or Query console interface to filter the results based on a stored attribute. It seems that no matter what I try for the attribute name I can't seem to get a match. I'm having difficulty finding definitive guidance on how the attribute naming works in the console i/f (most docs deal with API or CLI). In my case the attribute I want is called 'Code' and it is under a Map attribute called 'mqtt_data' so I'm assuming I should be using mqtt_data.Code as my attribute name.

I did find the following post https://stackoverflow.com/questions/62898632/how-to-filter-map-in-dynamodb-on-aws-console that suggests that "Filtering MAP or LIST in web console is not possible.". This would seem to be a problem for my use case as all of the data inserted by the IoT rule is under a single top-level MAP. Can anyone confirm if this is true? It seems odd to support MAPs in the CLI or API but not in the console. My preference is for the console so that my clients don't need to run code in order to get the data they need. Can anyone suggest a work-around?

Thanks! Phil

asked 8 months ago321 views
2 Answers
1
Accepted Answer

Your problem is you are trying to filter on a nested value, which is not possible in the web console. These are the only values to filter on: Enter image description here

You can use the PartiQL Web Console and issue a SQL like query, for exampe:

SELECT *
FROM MyTable 
WHERE mqtt_data.Code= 'some value' 
profile pictureAWS
EXPERT
answered 8 months ago
  • Thanks! PartiQL will probably work for us. Although I do prefer the Explore Items 'Form' view that lets you expand and collapse nested attributes. It would be great if AWS could combine the best of both worlds.

    Best regards, Phil

0

The tutorial you followed uses the DynamoDB[1] action. An alternative would be to use the DynamoDBv2[2] action to write the payload content to separate columns in the DynamoDB table. In this way you could leverage the DynamoDB Explorer UI to filter the items.

[1] https://docs.aws.amazon.com/iot/latest/developerguide/dynamodb-rule-action.html [2] https://docs.aws.amazon.com/iot/latest/developerguide/dynamodb-v2-rule-action.html

AWS
EXPERT
answered 8 months ago

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