New Delhi , Moti Nagar
+91-9007641046
subhendu@subhendumct.com

Let’s Make Data Management Easy ( SQL – No-SQL – CosmosDB)

Live in Future - Live in Cloud

Let’s Make Data Management Easy ( SQL – No-SQL – CosmosDB)

Greetings to my Extra-Ordinary students across the GlobE .

Today I am very excited to talk about Database and specially Azure CosmosDB . Azure CosmosDB its a ultimate database solution from Microsoft and it’s belongs from NO-SQL family . So , before talk about Azure CosmosDB let me tell you something about Data , Data management and how it’s connected with SQL or No-SQL .

First of all I am not from DBA team and I had very less interaction with Databases . So at the beginning of this journey I faced couple of challenges to understand data model and differences between different data-store . So if you are not from DBA team please read and understand all the line very carefully . 

So I will start from very basic of Data and Data management and then I will talk about the advance part of it . In real world we work with huge no of data and that’s why we need a special software/application or infra to manage it .

SQL server is a product of Microsoft and through SQL server you can manage your data in structured way . To read and write data from SQL DB we have to follow its language or Structured Query Language .

Apart from Microsoft SQL server there are couple of Open-source options such as MySQL, PostgreSQL and SQLite . 

SQL means Structured Query Language and SQL DB(DataBase) is a place where keep our data and we can retrieve when we need it . SQL engine will do all task for us and we will get our expected result through query .

But what does DATA mean :- Name , Any Number like Phone Number – Aadhar Number , Address , Photo , Video anything that we want to save in our database and that is consider as a RAW data . But when we fetch it we get the data in Row and Column format that’s why this data consider is a Structured data or Process data.

Limitation : To store data in SQL at first we have to define the structure or schema or in easy term we have to create the TABLE . We can create this table through GUI or through CLI but we need Structured Query Language to fetch or read data .

Due to this limitation NO-SQL came in picture . So let’s talk about NO-SQL from scratch .

No-SQL is a schema free database . Means in NO-SQL we don’t need to define schema or the structure of table where data will store in background . Where in SQL at first we define the structure of table or define schema and then we feed the data . But in NO-SQL we do not define schema . 

So what is the benefit ? Benefit is less latency . Because its follow a simple instruction to find out the data or specially it doesn’t need and any special language to read or to fetch data .

To handle or to manage verity of data we need diff kind of database or data store that is provided by NO-SQL . Those category’s are :

  1. Key-value
  2. Document
  3. Column-family 
  4. Graph 

Based on your data type you have  to choose data-category . If you need all category then you may need to depend on multiple product like MongoDB, CouchDB, Redis and Apache Cassandra .

NoSQL databases have existed since the 1960s, but have been recently gaining traction with popular options such as MongoDB, CouchDB, Redis and Apache Cassandra .

I believe now you can understand the difference between SQL and NO-SQL . 

So let’s talk about CosmoDB .

CosmoDB is the only product that support multiple  data category . Means it support Key-Value , Document . And graph . It’s a multi API database . it means to feed the data you can use multiple solutions like MongoDB . 

Features of CosmoDB : 

  • NoSQL JSON data Store
  • Pushbutton geo-replication
  • Low latency reads + writes
  • Provisioned throughput
  • Managed Service
  • Multiple consistency choices
  • No schemas , auto-indexed by default
  • Multiple data models and languages

4 vector for SLA :

  • availability
  • latency
  • consistency
  • throughput

APIs for the following data models are supported with SDKs available in multiple languages:

  • DocumentDB API: A schema-less JSON database engine with SQL querying capabilities.
  • MongoDB API : A MongoDB database service built on top of Cosmos DB. Compatible with existing MongoDB libraries, drivers, tools and applications.
  • Table API : A key-value storage database service built to provide premium capabilities for Azure Table storage applications.
  • Graph (Gremlin) API : A graph database service built following the Apache TinkerPop specification.
  • Additional data models coming soon! ** This information taken from Microsoft Official Website .

Let’s have a small comparison about different databases :

Screen Shot 2017-10-29 at 1.09.22 PM.png

I believe now you understood the power of CosmoDB . So lets have a demo .

Screen Shot 2017-10-28 at 11.03.15 PM.png

This is my Azure Subscription and here I am trying to create a Azure CosmoDB . So at first open portal and search for Azure CosmoDB .

Screen Shot 2017-10-28 at 11.07.41 PM.png

Provide all the deatils and select one API for this database . It mean you can Migrate your any kind of database over here .

Screen Shot 2017-10-28 at 11.09.02 PM.png

Here I am createing this database with MongoDB API .Screen Shot 2017-10-28 at 11.42.00 PM.png

As you can see my databse is provisioned and ready for work .

Screen Shot 2017-10-28 at 11.48.24 PM.png

And this is the overview of CosmosDB .

Screen Shot 2017-10-28 at 11.45.47 PM.png

Here is you all database connection string . You can copy this value and start working with your database .

If you want to use MongoDB API to migrate your data to Azure CosmosDB then you can

  • Download either mongoimport.exe or mongorestore.exe from the MongoDB Download Center.
  • After provider all details you will be able to download this software .
  • If you are importing data from MongoDB and plan to use it with the Azure Cosmos DB, you should use the Data Migration tool to import data.

Apart from that you can use Robo3T (Formally known as RoboMongo) to migrate your data .

Now go ahed and download and install this software .

Now go back to Azure portal and open your CosmosDB Connection Strings tab . Copy the connection string URL and paste over there .

After providing all details click on TEST CONNECTION .

After this you will be connected with CosmosDB . 

It was basic understanding of No-SQL and Azure CosmosDB . This not the END of data and data management . We have different way to store and to mange the data .I will talk about Azure DataWareHouse and Hadoop or HDInsight very soon .

I will post something for DB Migration Very Soon . Till the time take care and bye bye .

** I would like to big thanks Kuldeep Kumar and Sujit Roy for the help .

 

Leave a Reply

Your email address will not be published.