Alexa-skills-kit-sdk-for-nodejs: Primary key in dynamoDB

Created on 18 Oct 2018  路  3Comments  路  Source: alexa/alexa-skills-kit-sdk-for-nodejs

Hello

Sohan from the Alexa IN team. Is there a way to use a custom primary key for dynamoDB? Currently the ask-sdk uses userId as the default but was wondering if we could use deviceID as a primary key.

Tried Googling and looking at the docs but couldn't find a definitive answer.
Thanks in advance!

Most helpful comment

Sohan I just wrote a blog post in Japanese about this. You can override the default values with the PersistenceAdapter.

Here鈥檚 the RTD entry for it. You have to use the custom SkillBuilder.
https://ask-sdk-for-nodejs.readthedocs.io/en/latest/Managing-Attributes.html?highlight=DynamoDbPersistenceAdapter

All 3 comments

Sohan I just wrote a blog post in Japanese about this. You can override the default values with the PersistenceAdapter.

Here鈥檚 the RTD entry for it. You have to use the custom SkillBuilder.
https://ask-sdk-for-nodejs.readthedocs.io/en/latest/Managing-Attributes.html?highlight=DynamoDbPersistenceAdapter

Hey @sohanmaheshwar , as @SleepyDeveloper pointed out, the partitionKeyGenerator function in the DynamoDb Persistence adapter configuration is used by the SDK to populate the primary key value in the DynamoDb tables. It is defaulted to userId, but you can override this with any value you need. Does this help?

Oh that's great and exactly what I was looking for. Thanks @SleepyDeveloper and @nikhilym

Closing the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rmtuckerphx picture rmtuckerphx  路  3Comments

sandeepajesh picture sandeepajesh  路  5Comments

mehtanilay10 picture mehtanilay10  路  6Comments

kevinwu picture kevinwu  路  3Comments

developer170883 picture developer170883  路  4Comments