Open In App

AWS DynamoDB – Read Data from a Table

AWS DynamoDB is a NoSQL managed database that stores semi-structured data i.e. key-value and document data. It stores data in form of an item. An item consists of attributes. Upon table creation in DynamoDB, it only requires a primary key to differentiate between items and no schema is to be defined. Each item can have a different number of attributes. 

Amazon DynamoDB is a fully managed, serverless database and key-value pair NoSQL database that is designed for running the high-performance applications at any scale. So, DynamoDB also offers many built-in security,  continuous backups, multi-Region replication and in-memory caching. Disney, Dropbox, zoom, Snapchat are the customers of DynamoDB. Amazon DynamoDB has SLA of upto 99.99% of Availability. so, when the user uses the amount of data scaling, JOINs and some advanced SQL operations, this will lead to slow down in your queries. And With DynamoDB, the queries of users will shows the predictable latency upto any size, this may includes over 100 TBs!. DynamoDB is the simple key-value pair that accesses the patterns so as to make the fast, reliable choice.



Example 1:
{
  "ArticleID": 1,
  "NameofArticle": "DynamoDB"
}

Example 2:
{
  "ArticleID": 3,
  "NameofArticle": "Cloudwatch",
  "Service": "AWS"
}

To read data from a DynamoDB table, there are 3 ways:

  1. get-item – This is used in AWS Command Line Interface (CLI). To retrieve an item you must specify a table name and keys that you want to retrieve.
  2. Query – The items in the table can be retrieved by querying on the table. While querying, it by default contains the primary key as a search filter. More attributes can be added to refine search.
  3. Scan – It is similar to the query. The only difference is that it doesn’t have any attribute by default for searching. To search an item, you must define an attribute, and its value to find the item.

Implementation:



Read Data from Table:
 

To read data through Amazon Console we have two ways.

The following image is of the invalid query. The query contains ArticleID=2 and Service=’AWS‘. 

We see that the item ArticleID=2 does not have any attribute as Service. Therefore, no records were found.

Article Tags :