Reputation: 63
When fetching data into my GraphQL schema, does my data in a relational DB or my SOLR search engine need to be exactly like the GraphQL schema?
Upvotes: 1
Views: 2143
Reputation: 2245
Just like the one above me said.
You can basically do anything you want with your GraphQL schema.
Your schema might look a lot different from your database schema, you literally fit the GraphQL schema to the clients and expose everything you want to be exposed, in any way and form you'd like
Upvotes: 1
Reputation: 7172
The great thing (in my opinion) about GraphQL is that the schema is built for the applications/clients that consume it, and doesn't need to match the database schema. You can even have a GraphQL schema that combines multiple backends.
Resolve functions are the little pieces in GraphQL that actually connect the backends to the schema. Since resolve functions can contain arbitrary (and asynchronous) code, almost anything is possible.
I wrote a short post explaining how GraphQL is executed, including how resolve functions work: GraphQL Explained
Upvotes: 4