alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

Use several partition keys with DynamoDB Persistence Adapter #490

Open amallecourt opened 5 years ago

amallecourt commented 5 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Expected Behavior

It would be great to be able to use several distincts primary keys as partition key to store skill datas to the DynamoDB table using the functions available with the ask-sdk-dynamodb-persistence-adapter library (at leat two primary key).

Current Behavior

Currently, only the primary key can be used as a partition key when using the persistence adapter.

Possible Solution

This is a feature existing in the aws-sdk library with the classical way to save datas to DynamoDB tables (https://aws.amazon.com/fr/blogs/database/choosing-the-right-dynamodb-partition-key/). They refer to as a composite primary key, this type of key is composed of two attributes : the Partition Key and the Sort Key.

Context

Currently, we use the UserId by default to save persistence attributes to a DynamoDB table. But I would like to use the same DynamoDB table for several distincts skills (as my endpoint manages several skills in the same time). So I need to partition my table with the ApplicationId value too.

Your Environment

Node.js and NPM Info

tianrenz commented 5 years ago

Hi @amallecourt ,

Thanks for your suggestions! I'll bring this back to the team for further review.

I'd also like to point out that the DynamoDbPersistenceAdapter is more designed for the general use cases so that SDK can provide an easy-to-use out-of-box experience. We do recommend to use DynamoDB or any other storage solutions that suits your need with native tools (such as aws-sdk) to gain access to full set of the capabilities.

Regards

richjdsmith commented 5 years ago

This would be greatly appreciated as it would allow usage of some other data item as a Global Secondary Index, which would be great for sorting purposes (game leaderboards, etc). I'm struggling to do this without building a custom adapter, which I'd prefer not have to do if at all possible.

rahulawl commented 1 year ago

Is this issue/feature-request still relevant? We are working on prioritization of relevant issues and cleanup of rest. If we don’t hear back in 2 weeks, we will assume that the issue is not relevant and we will close it.