Thursday, January 16, 2020

Data Platform Tips 50 - Choosing appropriate API for Azure Cosmos DB

Data in Cosmos DB is stored in Atom Record Sequence (ARS) format.

Atoms consist of a small set of primitive types e.g. string, bool, number etc., records are structs and sequences are arrays consisting of atoms, records or sequences. The database engine of Azure Cosmos DB is capable of efficiently translating and projecting the data models onto the ARS based data model.

Azure Cosmos DB supports 5 different APIs and each supports different data models to use document, key/value, wide column and graph based data.

Core or SQL API - Default API in Cosmos DB and provides a view of the data similar to No-SQL data store. Allows you to query hierarchical data using SQL Query language. If you have prior experience with SQL, you can use the familiar SQL commands and clauses.
  • FROM
  • SUM
  • MIN
  • MAX
MongoDB API - Allows MongoDB clients to interact with the data as if they are running against MongoDB database. Data is stored in the format similar to Core SQL. Azure Cosmos DB's API for MongoDB is currently compatible with 3.2 version of the MongoDB.

Cassendra API - Allows to query data using Cassendra Query Language (CQL). Data will appear to be a partitioned row store. Like MongoDB API, existing clients can connect to Azure Cosmos DB and only the connection string needs to be updated.

Azure Cosmos DB supports familiar CQL commands and clauses.
  • USE
  • BATCH (Only unlogged commands are supported)
Azure Table API - Provides support for applications written to use the Azure Table Storage. Original Table API only allows for indexing on the Partition and Row keys; there are no secondary indexes whereas in Comsos DB it automatically indexes all the properties. Data can be queried using LINQ, OData or REST API.

Gremlin API - Provides graph based view of the data. Graph based data is transferring the data into nodes and its relationships into edges. Normally traversal language is used to query a graph database, and Azure Cosmos DB supports Apache Tinkerpop's Gremlin language.

No comments:

Post a Comment