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

demandé il y a 5 ans6673 vues
6 réponses
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"
}
}
}

répondu il y a 5 ans
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

répondu il y a 5 ans
  • 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?

répondu il y a 5 ans
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.

répondu il y a 5 ans
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.

répondu il y a 2 ans
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
répondu il y a 5 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions