Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (1.4k points)

I need to add an attribute dynamically in dynamodb but I’m encountering an error as The provided key element does not match the schema". May I know If I’m able to add?

The scenario is as follows:

{ id : "123", imageName : "elephant.jpg" }

Also, I need to add an attribute to the above data  - imagePath: "/path/to/image" and use put_item for adding an attribute that replaces the older item. Please let me know how to add an attribute dynamically to an existing data using update_item or else should I need to alter the schema with imagePath before using update_item function?

1 Answer

0 votes
by (2.6k points)
edited by

It can be done over in a two-step process but it can’t be done in a single step:

  1. Insert the data and if the key value is already there please do not perform any operations like insert or update.

  2. Update item if you find the following:


Want to know more about AWS DynamoDB and master all AWS Skills? Go through AWS Certification Training!

To know more about aws database

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories