Scan nested attributes in dynamoDB AWS Console

0

Hello,

I have a DynamoDB Table with nested objects.
Items look like this:

{
  "attributes": {
    "playbackIndexChanged": true,
    "playbackInfo": {
      "episodeGuid": "podlove-2018-05-02t19:06:11+00:00-964957ce3b62a02",
      "inPlaybackSession": false,
      "lastFinishedEpisodeGuid": "podlove-2018-05-02t19:06:11+00:00-964957ce3b62a02",
      "nextStreamEnqueued": true,
      "offsetInMilliseconds": 246981
    }
  },
  "id": "12345567"
}

now i would like to scan this table directly in the aws console of the dynamodb service.

But if i add on the Items registercard a Filter who looks like this
attributes.playbackIndexChanged Boolean = true

i doesn't find any results.

Can someone please give me an hint? i couldn't find something in the documentation.

Kind Regards
Stefan

質問済み 5年前6443ビュー
6回答
1

Hey Stefan,

We got some hints for you from our team. Filter/condition expressions for maps have to have key names at each level of the map specified separately in the expression attributeNames map.

Your expression should look like this:

{
"TableName": "genericPodcast",
"FilterExpression": "#keyone.#keytwo.#keythree = :keyone",
"ExpressionAttributeNames": {
"#keyone": "attributes",
"#keytwo": "playbackInfo",
"#keythree": "episodeGuid"
},
"ExpressionAttributeValues": {
":keyone": {
"S": "podlove-2018-05-02t19:06:11+00:00-964957ce3b62a02"
}
}
}

回答済み 5年前
0

Hello,
I would like to do it without coding. i would want to scan the dynamodb via the aws console (webinterface of the dynamodb-service).

but additionally i tried it with coding like this:

    var params = {
        TableName: "genericPodcast",
        FilterExpression: "#episodeGuid = :myEpisode",
        ExpressionAttributeNames: {
            '#episodeGuid': 'attributes.playbackInfo.episodeGuid',
            // '#episodeGuid': 'attributes',
        },
        // ExpressionAttributeValues: { ":myEpisode": { "S": "podlove-2018-12-06t13:07:10+00:00-f8a9b2963f313e5" } }
        ExpressionAttributeValues: { ":myEpisode": "podlove-2018-12-06t13:07:10+00:00-f8a9b2963f313e5" }
    };
    oDynamoDBClient.scan(params, async function (err, data) {
        console.log('read return');
        if (err) console.log(err, err.stack); // an error occurred
        else {
            console.log(data);
        }
    });

With coding i didn't find results. i doesn't get errors, but i also don't get results.

maybe you could help me with both problems.

  1. how to set the filter to scan items in the aws console (webinterface) without coding
  2. help me to fix my coding to be able to scan dynamodb programmatically too

Kind Regards
Stefan

回答済み 5年前
  • I would like to know how to do this through the AWS console too "aws console (webinterface of the dynamodb-service)." I've been looking everywhere I don't know how to do it.

0

Hey Stefan,

Can you paste the code for the scan?

回答済み 5年前
0

Hey Stefan,

You can definitely scan a table through the AWS management console. After you login, go the DynamoDB console and select the table you want to scan. From there, click on the items tab and you should be able to both scan and query the table.

I will ask one of our developer evangelists to look at your code, but in the mean time, have you checked out the docs on scans?

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html

There may be some hints in there.

回答済み 5年前
0

I would like to know how to do this through the AWS console too "aws console (webinterface of the dynamodb-service)." I've been looking everywhere I don't know how to do it.

回答済み 2年前
0

You can do that via PartiQL editor (it's right there in the DynamoDB page).

An example query which worked for me:

select * from "schedules" where data.origin.country = 'United States'

(note the double quotes for the table name and the single quotes for the string)

Cristan
回答済み 4ヶ月前

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

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

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

関連するコンテンツ