102 | Big Data Simplied
super-columns, but not the actual columns within them. So, the actual columns can differ from
row to row. But the column families or super-columns, which clearly imply a certain category or
domain of data, do need to be declared, when the table is designed.
Apache Hbase, which is a part of virtually every single Hadoop distribution is one of the most
prominent examples of Wide Column stores or Columnar Databases. Cassandra is a significant
second.
5.3.3 Document Stores
Next, we look at Document Stores, where instead of having rows basically you have documents.
Conceptually, the documents in a Document Store are similar to rows. The documents contain
key and value pairs. A minor difference here is that the value of a key can itself be a document.
The documents can be JavaScript objects. They are encoded using JavaScript Object Notation
or JSON. JavaScript language ends up being used as the internal language for these databases as
well. The documents can also be in XML or other semi-structured formats. All these technologies
are extremely familiar to a web developer. As such, the document stores tend to be highly used in
web applications, because through this technology, the static content in a website and the actual
data-driven content end up having a lot in common.
Figure 5.3 Wide column stores
Table: Customers Table: Orders
Row ID: 101
Super Column: Name
Column: First_Name: John
Column: Second_Name: Doe
Super Column: Address
Column: House_No: 123
Column:Street_Name: Park
Street
Super Column: Orders
Column: Last_Order_ID: 1701
Row ID: 1701
Super Column: Pricing
Column: Price: 1000 USD
Super Column: Items
Column: Item_ID: 2345
Column: Item_ID: 7890
Row ID: 102
Super Column: Name
Column: First_Name: Jane
Column: Second_Name: Doe
Super Column: Address
Column: House_No: 456
Column:Street_Name: Green
Street
Super Column: Orders
Column: Last_Order_ID: 1702
Row ID: 1702
Super Column: Pricing
Column: Price: 700 USD
Super Column: Items
Column: Item_ID: 4321
Column: Item_ID: 5446
M05 Big Data Simplified XXXX 01.indd 102 5/20/2019 7:42:43 PM
Introducing NoSQL | 103
Refer to the example in Figure 5.4. You will notice that Customers and Orders are stand-alone
containers that have no overall parent. In this case, they are called databases. Instead of contain-
ing rows, they contain documents. The Customer document 101 has an Address key, and the
value of that key is itself a document, with keys and values for House Number and Street Name.
You will also see that the Orders key has a document as its value, and that document, in turn, has
a key called Last_Order_ID. The value of that key points to a document in another database, in
this case, the Order document 1501 in the Orders database.
So, we can have hierarchical relationships and we can have relationships between documents,
even if they are in different databases as seen in this example. Document stores are schema-free
as well.
This structure supports the operations as listed below.
Insert (key, document)
Update (key)
Delete (key)
Fetch (key)
CouchDB and MongoDB are the two most prominent examples of a Document Store.
Figure 5.4 Document store
Database: Customers Database: Orders
Document ID: 101
First_Name: John
Second_Name: Doe
Address:
House_No: 123
Street_Name: Park Street
Orders:
Last_Order_ID: 1701
Document ID: 102
First_Name: Jane
Second_Name: Doe
Address:
House_No: 456
Street_Name: Green Street
Orders:
Last_Order_ID: 1702
Document ID: 1701
Price: 1000 USD
Item_ID: 2345
Item_ID: 7890
Document ID: 1702
Price: 700 USD
Item_ID: 4321
Item_ID: 5446
M05 Big Data Simplified XXXX 01.indd 103 5/20/2019 7:42:44 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.51.157