Nothing Special   »   [go: up one dir, main page]

Dynamo DB

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

DynamoDB

NoSQL
• Storage, retrieval of databases

• NoSQL is a non-relational database that is used to store the data in the nontabular
form.

• NoSQL stands for Not only SQL.


• NoSQL is a non-relational database that is used to store the data in the nontabular form. NoSQL stands for Not only SQL.
SQL vs NoSQL
• Relational database (data stored in tables) • Non-relational database
• Table based • Document databases, Key-value
• Structured data (can be neatly organized in pairs, Wide-column stores , Graph
rows and columns & easily analysed) databases
• Vertically scalable • Semi-structured (not stored in rdbms
but has some organizational
**Vertical scaling refers to scaling by adding properties that make it easier to
more power (e.g., CPU, RAM) to an existing analyse: XML data) & Unstructured
machine data (not organized in a predefined
manner,word,pdf,text, image, video)
###the ability to expand the capacity of a • Horizontally scalable
database system in order to support ** Horizontal scaling means adding
larger amounts or requests and/or store additional machines into your database
more data without sacrificing cluster, each of which handles a subset
performance. of the total data.
• Fixed schema (data needs to • Dynamic schema (dynamic
conform to this to be accepted) schemas emerge based
• SQL is a mature technology – on the qualities of the
many experienced devs data that is entered into
understand it, great community the system)
& vendor support – independent • Comparatively new - reliant on
consultations community support – not many
outside experts
Benefits of nosql
• Flexible schemas
• Faster queries (Data in SQL databases is typically normalized, so
queries for a single object or entity require you to join data from
multiple tables. As your tables grow in size, the joins can become
expensive. However, data in NoSQL databases is typically stored in a
way that is optimized for queries.)
ACID
• ACID stands for:
• Atomic – Each transaction is either properly carried out or the process
halts and the database reverts back to the state before the transaction
started. This ensures that all data in the database is valid.
• Consistent – A processed transaction will never endanger the
structural integrity of the database. Changes made in the db should be
preserved always.
• Isolated – Transactions cannot compromise the integrity of other
transactions by interacting with them while they are still in progress.
• Durable – The data related to the completed transaction will persist
even in the cases of network or power outages. If a transaction fails, it
will not impact the manipulated data.
Types of NoSQL databases

• Document databases
• Key-value databases
• Wide-column stores
• Graph databases
Document based database
• Stores data in JSON, BSON, or XML documents.
• Flexible schema, other documents in the db need not
have the same schema
• Easy creation and minimal maintenance
• No dynamic relationship b/w documents so they can
independent of each other
Key-Value databases
• Simplest form of nosql db.
• Every data element stored in key-value pairs.
• Values can be strings, numbers or complex objects
• Data retrieved by using a unique key allotted to each data element.
• Simplicity, speed
Wide-column stores
• Store data in column instead of rows.
• designed to read data more efficiently and retrieve the
data with greater speed.
• A columnar database is used to store a large amount of
data.
Graph databases
• Focuses on relationship between the elements.
• Stores data in the form of nodes in the database.
• easy to identify the relationship between the data by
using the links.
• The speed depends upon the number of relationships
among the database elements.
AWS DDB
• Fully managed NoSQL database service that provides
fast and predictable performance with seamless
scalability.
• DynamoDB provides on-demand backup capability.
It allows you to create full backups of your tables for
long-term retention.
• OPTIONAL###Programming done using Boto3 library in
python
• You can access Amazon DynamoDB using the AWS
Management Console, AWS CLI, or the DynamoDB
API.
Naming Conventions
• Meaningful and concise.
• Case - sensitive
• Table & index names - 3 – 255 characters
• Attribute names – atleast 1 char long
• Contains [a-z], [A-Z], [0-9], (_),(-),(.)
Data Types
• Scalar Types
• Document Types
• Set Types
Scalar Types
• Can represent only one value--
• Number
• String
• Binary
• Boolean
• Null
Document types
• can represent a complex structure with nested
attributes, such as you would find in a JSON document
• Types are – list, map
Set Types
• Can represent multiple scalar values-
• Types – string set, number set, binary set.
Core Components
• Tables – group of items
• Items – group of attributes (ROWS)
• Attributes – data element (COLUMN)
Primary key
**primary key must be scalar(single value), string, number or binary.
Provide primary key at the time of table creation.

• Partition key – simple primary key, composed of one attribute


DDB uses value of partition key as i/p of internal hash function. The o/p
from the hash function determines the partition (physical
storage internal to DynamoDB) in which the item will be stored.
• Partition key & Sort key – two attributes – also called composite primary key.
Multiple same partition key but sort keys diff.
Creating Table
• You have to pass the following attributes:
• TableName,
• KeySchema – primary key attributes (HASH-partition::RANGE-sort)
• AttributeDefinitions – data types for keyschema
attributes
• ProvisionedThroughput (for provisioned tables) –
Number of reads and writes per second that you need
for this table. DynamoDB reserves sufficient storage
and system resources so that your throughput
requirements are always met.

You might also like