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년 전6674회 조회
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
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠