We have existing SQL Server database and we are using C#. Lets say our mobile client send a graphql to server. How can I convert this SQL, so that my client get the data what he expect?
GraphQL is a flexible query language that uses a type system to efficiently return data with dynamic queries. SQL(structured query language) is an older, more adopted language standard used specifically for tabular/relational database systems. Consider GraphQL if you want your API to be built on a NoSQL database.
Your GraphQL API can interact with any combination of data sources. Apollo provides a DataSource class that we can extend to handle interaction logic for a particular type of data source. In this section, we'll extend DataSource to connect both a REST API and a SQL database to Apollo Server.
You can integrate data from any type of backend into a GraphQL layer, making this advantage accessible to any type of project. Today, we'll take a look at how to integrate a GraphQL API and MySQL database in your GraphQL layer. As a result, a developer can access data from two different backends in a single query!
Dgraph - The Native-GraphQL Database and Cloud Platform Dgraph offers a solution that was built specifically as a GraphQL database. This is unlike other GraphQL database offerings that have added GraphQL to existing databases. Dgraph was engineered around the kinds of data and queries that GraphQL apps need.
GraphQL and SQL, while sounding similar, solve different problems. SQL is used to query a database directly. GraphQL is used to query data sources of any kind, such as databases (through SQL or client libraries), APIs, and static files. GraphQL can be compared to REST or ad-hoc API endpoints.
One solution would be to create the GraphQL implementation yourself. GraphQL.org has a lot of great information about how to implement and use a GraphQL server. If that's too much work, you could piggy back off of this project: GraphQL .NET
Also consider looking at other GraphQL implementations, such as ApolloStack. If you can have your GraphQL server separate from your .NET server, you could use ApolloStack or another Javascript GraphQL server to host your data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With