How to Retrieve Data from DynamoDB Without Using Primary Keys?

0
0
Asked By CuriousCoder92 On

I'm diving into DynamoDB for the first time with Python, and I'm a bit confused about data retrieval. I don't have matching primary keys (PKs) and would like to know if there's a way to fetch data using column names instead. Specifically, I'm interested in retrieving information from the columns School, Color, and Spelling for a character like Student1, even if this data is in different tables or associated with various keys. Any guidance on this would be really appreciated!

3 Answers

Answered By DataWhizKid99 On

Also, keep in mind that because DynamoDB is NoSQL, traditional joins or lookups across different tables aren't supported. If your data relationships are critical, a SQL option might be worth considering for future projects.

Answered By TechSavvyGirl07 On

DynamoDB is quite different from a traditional relational database! The primary use case is using primary keys to look up your items. If you don't have your keys handy, you might want to consider two options:

GamerGeek235 -

What are those options? I'd love to know how to make this work without primary keys!

Answered By DynamoDude44 On

One good approach is to use Global Secondary Indexes (GSIs). These let you create indexes based on other attributes like School, Color, and Spelling. Just keep in mind, you can have a maximum of 20 GSIs per table, and they are eventually consistent. If that doesn't work for you, there's also the option of performing a full table scan, which isn't the most efficient method, but could be acceptable for smaller tables.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.