Please enable Javascript for better experience...
Configuring Cosmos DB Table API in Azure - Step By Step
By Rahul Kumar Jha | Apr 30, 2020 | In Articles | Total Views [ 1833 ]
Taged In
(0 Like)
Rate

In this article you will learn the steps to configure Cosmos DB Table API in Azure.

Introduction

Cosmos DB has five APIs. In this article we will cover table API of Cosmos DB. So let see the steps one by one. Without wasting time, I will directly go with the steps to configure table API.

Steps to configure cosmos DB Table API

Go to Azure portal and click on Cosmos DB tile. Here is the URL.  https://portal.azure.com/#home

pic1

You will land on Cosmos DB resource landing page. Here you can create a new Cosmos DB account of any desired type (We will take table). You will also find existing accounts if any. Click on “+ Add” link to add new account.

pic2

Here you need to add resource group first. You can create new resource group from “Create New” link or you can also select existing resource group from dropdown if any.

pic3

I have already a trial account, so selected the same. Next step is to add account name and select API type. Here I am showing demo for Azure table so selecting Azure Table.

pic4

I have kept rest as untouched like using account type as non-production for demo purpose and rest as default. You can select location as per your requirement. Keep Geo-Redundancy and Multi-region Writes options disabled to avoid additional charges. Skip the Network and Tags sections and click on “Review + Create” to continue.

pic5

Request will be validated and if everything is ok, you will see success message. Review the data you have feed and click on Create button to create the account. Deployment will take some time to configure and create account.

pic6

Once deployment is completed, click on “Go to resource” button to jump to dashboard.

pic7

You will reach to dashboard page where you can find account overview like account details, subscription details with some other details cost, resources etc. Now next step is to create a table. For that, click on “Data Explorer” button or link at left panel.

pic8

Click on “New Table” to create a table.

pic9

Add table name and select throughput. I have kept default as 400 but you can choose as per the load and cost.

pic10

DB is created successfully at this point with name as TableDB having table Person with blank entity as of now. To add entity click on “Add Entity” link.

pic11

You will see two default field as PartitionKey and RowKey. Apart from this, you can add custom columns as per requirement from “Add Property” button underneath.

pic12

Second time when you try to add entity, you will see column names by default and just require to add values.

pic13

PartitionKey and RowKey are unique values and you can use them to maintain uniqueness in your table. Apart from these default columns, you can notice one more column Timestamp that generated automatically. After you added rows in your table, you can view them as below.

pic14

To query data, simply select column name from dropdown and enter value to apply filter. You can select more columns using “Add new clause” button. Run query using “Run Query” button.

pic15

Hope this helps you

Share this

About the Author

Rahul Kumar Jha
Rahul Kumar Jha
Founder, Developer dotnet-concept.com

Public profile: user/profile/99900001


Has working experience in different phases of Software Development Life Cycle (SDLC) in CMS, Gaming, Health Care and Financial Services domain using Agile pattern. Working experience in Design patterns, ASP.NET, MVC, ANGULAR, ANGULAR JS, Windows application, WCF, ADO.NET, SQL Server and Test Driven Development (TDD) environment with JQuery, JavaScript, N-Unit, Entity Frameworks, LINQ, Code Refactoring and Business Objects Models.

User's Comments


 
Please SignUp/Login to comment...

Or comment as anonymous...
* Name
* Email ID
Comment
 
 
 
 
 
 
Sponsors