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

質問済み 9ヶ月前348ビュー
2回答
1
承認された回答

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
エキスパート
回答済み 9ヶ月前
  • 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
エキスパート
回答済み 8ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ