Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Graphql to SQL?

Tags:

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?

like image 525
Imran Qadir Baksh - Baloch Avatar asked Sep 22 '16 15:09

Imran Qadir Baksh - Baloch


People also ask

Is GraphQL SQL or NoSQL?

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.

Can GraphQL connect to 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.

Does MySQL support GraphQL?

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!

Which database is best for GraphQL?

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.


1 Answers

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.

like image 143
Alex Anderson Avatar answered Sep 25 '22 11:09

Alex Anderson