Microsoft Azure Data FundamentalsDescribe how to work with non-relational data on AzureHard

A startup is building a new social media platform where users can follow each other, and posts can have nested comments and likes. The application requires storing complex relationships between entities (users, posts, comments) and performing efficient traversal queries. Which Azure Cosmos DB API is most appropriate for this data model?

  1. AAzure Cosmos DB for NoSQL (Core) API
  2. BAzure Cosmos DB for Gremlin (Graph) API
  3. CAzure Cosmos DB for Table API
  4. DAzure Cosmos DB for Cassandra API
Show answer & explanation

Correct answer: B. Azure Cosmos DB for Gremlin (Graph) API

The Gremlin (Graph) API is specifically designed for managing and querying highly connected data, making it ideal for social media applications where relationships (follows, likes, comments) between users and content are central. Its traversal capabilities are optimized for such scenarios.

Why the other options are wrong

  • A. The NoSQL (Core) API is for document data, which can store complex nested JSON, but querying relationships across documents is less efficient than a graph database.
  • C. The Table API is for simple key-value data, which is too restrictive for complex social media relationships.
  • D. The Cassandra API is for column-family data, suitable for migrating existing Cassandra workloads, but not inherently optimized for graph traversals.

Azure Cosmos DB Gremlin (Graph) API

The Gremlin API in Azure Cosmos DB supports graph data models, allowing for the storage of entities (vertices) and their relationships (edges). It uses the Apache TinkerPop Gremlin query language for efficient traversal of highly connected data.

  • Optimized for connected data and relationship querying.
  • Uses Apache TinkerPop Gremlin query language.
  • Ideal for social networks, recommendation engines, fraud detection.
  • Vertices represent entities, edges represent relationships.

Memory trick: Cosmos APIs: Documents, Tables, Graphs, and Cassandra for your data needs.

More Describe how to work with non-relational data on Azure questions