The tables data model

Cosmos DB provides the tables data model as an API, which you can use to build a distributed key value store using the standard table query model.

Table API is one of the first in the market with a managed distributed key value store. Let's look at the features provided by Table API:

  • Low latency: Table API with Cosmos DB provides single digit latency for reads and write with SLA
  • Variable throughput: Table API has a variable throughput model. You can change the scalability limit as you grow
  • Elastic scale: You can scale the database across any number of Azure regions supported
  • Automatic indexing: Cosmos DB with Table API creates indexes for all properties for faster read and write operation
  • Advance query support: Cosmos DB provides advance query such as aggregation, geospatial query, and sorting on top of Table API
  • Multiple consistency: You can choose consistency level among the five provided by the Cosmos DB as per your need

Let's go ahead and create a table data model in Cosmos DB:

  1. Log in to your Azure portal and click on the Azure Cosmos DB option on the left side of the option bar.
  2. Click on the + button and give your new database a proper ID, choose the Table (key value) option from the API drop down.
  1. You can create a new resource or use the existing one. Select the location where the most writing will happen and click on the Create button. You can refer to the following screenshot for further information:
  1. Azure will create the new database with Table API and notify you of the same. Once the table data model is created, we can create new collections in it and store the data. Go to Data Explorer on the left menu and click on the New Table button. Give your table a name and click on the OK button. Refer to the following screenshot for further information:
  1. Once the table is created, we can create a key value pair in it. Click on the New Entity button and add the following values:

You can create as many entities as you want with the Query Explorer. You can always create a stored procedure and triggers for your application if you need.

Let's go ahead and learn about the last but not the least data model in Cosmos DB that is, graph data model.

..................Content has been hidden....................

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