Open In App

How To Use Azure Cosmos DB To Create And Manage NoSQL Databases

Last Updated : 04 Mar, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Azure Cosmos DB is a multi-model, globally distributed database service provided by Microsoft Azure. It comes as a fully managed database service with turnkey global distribution and transparent multi-master replication. You can run globally distributed, low-latency operational and analytics words and AI on transactional data within your database. Azure Cosmo DB is used to create and manage the NoSQL databases. Let's discuss how we use Cosmo DB to create the NoSQL database and manage it.

What Is Azure Cosmos DB?

Azure Cosmos DB is a fully managed NoSQL and relational database for modern app development including AI, digital commerce, Internet of Things, booking management, and other solutions. Azure Cosmos DB offers single-digit millisecond response times, automatic and instant scalability, along guaranteed speed at any scale. Business continuity is assured with SLA-backed availability and enterprise-grade security.

What Is NoSQL Databases?

NoSQL databases (aka "not only SQL") are non-tabular databases and store data differently than relational tables. NoSQL databases come in a variety of types based on their data model. The main types are document, key-value, wide-column, and graph.

NoSQL Databases

  • After getting subscription you can view like below.

Screenshot-2024-02-21-231743

  • You can search for Azure Cosmo DB. In order create Azure Cosmo DB Account you go through Set up for Azure Cosmo DB. After Set Up you get the like this below image.

Successful creation Of Azure Cosmos DB Account

  • After Creation of Azure Cosmos DB account.

Creating Azure Cosmos Database: A Step-By-Step Guide

Step 1: In the left navigation pane, under "Data Explorer", click on "New Container" dropdown where you find option called New Database.

Navigating to New Database

Step 2: After clicking on New Database option you can observe like this below.

Creating New Database

  • I provided Database id as mydatabase you can give whatever you want. Remaining things are I keep it as default.
  • Based on your requirement you can change throughput and Database MAX RU/s.

Step 3: Click on ok button. You can observe the picture below. that we successfully created database. we can observe our database under DATA.

Successfully Database Created

Step 4: Inside the database, click on "New Container" to create a container within the database. Containers in Cosmos DB are similar to tables in relational databases.

Step 5: Configure the container settings, including a unique container ID, partition key, and throughput ( request units per second ).

Creating A New Container

  • After configuring the new container with defining values enable the container.

New Container

Step 6: Container created successfully in the database. We have many options like query, creating item and upload item etc.

Choosing Option of created database

Step 7: Using the following URI in picture below. We gonna connecting from any kind of API or a code to this database.

API of database

Step 8: Here we can add data manually using the option new item which you can observe in. After clicking on option you get like below.

No SQL APIs
  • I just add few objects in the items list. Based on your requirement add it manually or through an API call for that you can refer Set up for Azure Cosmo DB.
Manually adding objects in list
  • I just manually created something like the above. After that I saved the new item. I observe few objects are added.
Observing Added objects
  • You can create as many as you needed and we can also query the data using query button option by writing some SQL commands. You can observe below.
Writing SQL queries
  • After execution of the query we can observe the item that we created
Executing A SQL Query

Next Article

Similar Reads