meds
meds

Reputation: 22956

Using GraphQL to connect to CosmosDB?

Is there a path to follow where you can interface with Azures CosmosDB using GraphQL along with an Azure Functions interface if there needs to be a place where logic is executed.

Upvotes: 2

Views: 6986

Answers (3)

Steve Faulkner
Steve Faulkner

Reputation: 74

I've published a demo of using GraphQL backed by the Azure Cosmos SQL API https://github.com/southpolesteve/graphql-cosmos-demo. It could easily be hosted on Azure Functions

Upvotes: 0

David Lee
David Lee

Reputation: 73

I have started on a project Eklee-Azure-Functions-GraphQl to implement a GraphQL interface served by Azure HTTP function(s). It currently supports Azure Cosmos DB SQL API. The GraphQL interface is using graphql-dotnet. It uses a Model-first approach to define and automatically generate your schema. It supports both query and mutation.

Upvotes: 5

markusw
markusw

Reputation: 2065

As far as I know CosmoDB at this time only supports these APIs:

  • Standard SQL
  • MongoDB
  • Cassandra
  • Azure Table
  • Gremlin

If you want to use the GraphQL protocol to query it, you might need to create a wrapper, that translates the GraphQL queries to the appropriate interface.

I would suggest to go for a MongoDB API and implement functions that accept the GraphQL queries and interact with the MongoDB. This should be easy, because MongoDBs queries are looking pretty the same [1].

[1] https://medium.com/the-ideal-system/graphql-and-mongodb-a-quick-example-34643e637e49

Upvotes: 1

Related Questions