5

I'm interested in using the Azure CosmosDB for it's Graph capability. Looking through the docs i saw that it sores graph vertices and edges as JSON documents (with an agreed schema) and so it can be accessed as a plain old DocumentDB.

Taking this into consideration what is the meaning of the API selection you need to make when creating a new instance (link)?

eg :

  • what am i losing if i create the DB as SQL (DocumentDB) and manipulating data via the graph part of the client (eg CreateGremlinQuery)
  • what am i losing if i create the DB as Graph and manipulating data via the DocumentDB part of the client (eg CreateDocumentAsync)

UPDATE : I am aware of the portal difference (as described below by Jesse Carter). I am interested if this switch drives anything else under the hood in the specific scenario of choosing between SQL(Document DB) vs Graph

RazvanG
  • 83
  • 4

2 Answers2

2

There is no functional difference from the perspective of interacting with your Cosmos Collection through either SQL or Graph APIs regardless of which API you choose at creation time.

HOWEVER, there is a difference from the perspective of the Azure portal when navigating your resources. Collections created specifically using the Graph API will get tagged as such and enable additional UI features in the portal for executing Gremlin queries and basic graph visualization.

If you don't care about those querying abilities in the Azure portal, then you're fine to create the collection with either option.

Jesse Carter
  • 20,062
  • 7
  • 64
  • 101
  • Thanks for your answer. Would you happen to remember where you found out about this (docs / video). I've only found the same explanation on a 3rd party [blog](https://vincentlauzon.com/2017/09/10/hacking-changing-cosmos-db-portal-experience-from-graph-to-sql/). The official msdn and the email exchange with the guys at askcosmosdbgraphapi@microsoft.com were not so specific (read vague) – RazvanG Nov 02 '17 at 16:31
  • I don't have a reliable source from offical docs. Only ran across it in a similar post online and through personal experience of creating different collection types in Azure – Jesse Carter Nov 02 '17 at 17:33
  • Was pretty much expecting this but I hoped I had missed something. Thanks for your help. Marked this as the answer at this moment – RazvanG Nov 03 '17 at 12:08
1

API selection is to avoid confusion for users who are only familier with gremlin and don’t want to learn documentDB.

If you are an advanced user, using both graph and documentDB will give you more power.

Note that we are committed to making the gremlin and documentDB SQL integration even more seamless.

Please drop us a note askcosmosdbgraphapi@microsoft.com, if you want to lean more or set up a time to talk to us.

Jayanta

Jayanta Mondal
  • 436
  • 2
  • 5
  • Thanks for your reply. Just so I am clear on this : is it corect to say that in the case of CosmoDB SQL vs Graph the API setting used on creation has no impact - aka there is no under the hood unseen feature (some specific indexing maybe) that is based on the selection you make? – RazvanG Nov 01 '17 at 06:24
  • @RazvanG That is correct the choice between CosmosDB SQL and Graph is agnostic to the underlying document collection that is created, and both APIs are able to connect to the same collection. Note that there are some limitations around what CosmosDB Graph API can read/write on the collection, but no such limitations exist for SQL. – Oliver Towers Nov 05 '17 at 00:57
  • 1
    Thanks for your answer. As I've asked [above](https://stackoverflow.com/questions/47045818/cosmosdb-creation-api-option-sql-vs-graph#comment81109470_47074739) would you happen to remember where is this documented? – RazvanG Nov 05 '17 at 10:37