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.
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.
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
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
Related
Does anybody know if there is a way you can import data into an Azure SQL Database, using an GraphQL API? Or if you could create a connection within an iPaas system to send data to the Azure SQL database?
Since you want to exchange data between azure sql database and GraphQl.
Directus can be used which is an open-source Data Platform that enables anyone to access and manage the database content.
Directus will give us a GraphQl API to be used with the data .
Refer the following article to setup the azure sql database and directus .
I am working on the design where the contents in the postgres schema will be static. But in case anything is updated to these static content I want to be able to trigger an Azure Function app to capture these updates and send the update to the device(Function App-> IotHub-?Device).
Looks like the PostGres DB is not supported by Azure Functions (input/output binding).
Azure Function supports limited bindings.
As per this MS Doc reference, although the special database which you specify may not be supported by the function's binding.
But You can still install the necessary packages and write the connection, input, and output code within the function logic.
The above is essentially the same as binding.
Here are the few workarounds references where Postgres connected through code in Azure Functions:
Azure Functions integration with Postgres in Node.js
An Article of .Net Stack Azure Functions using PostgreSQL
An Article of Connect from Function app with managed identity to Azure Database for PostgreSQL
Connect to PostgreSQL using Azure Java Functions
Does Azure function work with triggers,input,output bindings for CosmosDB with MongoApi? Are there any way past this apart from using a MongoClient?
As documented here, Cosmos DB bindings are specific to the SQL API.
For any other binding (such as MongoDB API, which you're asking about, or Cassandra, Gremlin, etc), you'd need to use a language-specific client SDK. In your case you'd need to work with a MongoDB client from your Azure Function.
I am new to Azure Cosmos DB. I have created Azure Cosmos DB with SQL API and loaded the data and used SQL Queries. Now I want to access the Mongo API of the same DB. Is it possible?
Upon online search, I found confusing answers.
Connecting The Same Cosmos DB Database Using SQL API And Mongo API From A Blazor App
The extensible APIs that you can use include .NET, .NET Core, Node.js, Java, Python, and MongoDB. If you’re using .NET, you can use DocumentDB API, MongoDB API, Graph API, or Table API. Java and Node.js will only work with the Document DB APIs, MongoDB APIs, and Graph APIs. Python will only work with the DocumentDB API, and Gremlin, only the Graph API.
I understand that the same DB can be accessed with SQL API and Mongo API, as long as I use .NET
Am I right?
If yes, please let me know the procedure.
I understand that the same DB can be accessed with SQL API and Mongo
API, as long as I use .NET
Am I right?
No. While it might be technically possible, it is not supported to use multiple APIs. You have to stick to the one that you chose when creating the database.
The only exception is Gremlin and SQL API.
https://learn.microsoft.com/en-us/azure/cosmos-db/faq#can-i-use-multiple-apis-to-access-my-data
I am trying to get to grips with Azure Mobile Services and am a little lost about which Azure services I should be using for what. When you set up a new Azure Mobile Service you only get the option to create it with Microsoft SQL Server as the database. Can you configure it to use the documentDB service instead?
Also a lot of what I read about Azure Mobile Services seem to be setup around storing data for a particular user. Is this the correct place to store data and query it for all the systems users rather than an individual or should that be handled elsewhere?
thanks
Andy
using the .NET backend, you have a choice of using Azure SQL Database,MongoDB or Table Storage. There's no out of the box support yet for DocumentDB, but you can make it work as shown here
what you store in the storage listed above is up to you, there is no specific reason/restriction/limitation that's its only for user specific data. the samples just happen to show that.
You may use any backend database service. It's true you have to set up SQL when you create a new mobile service space. And the SDK has a Table provider that maps to SQL (or MongoDB). However, you can ignore all that if you want. As long as you can access the appropriate driver for your database-of-choice, you can make calls to the database from the API backend methods. This is especially true when building custom API methods.