You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to fetch data to populate my GraphQL API from a database. All the examples I found so far were either hardcoded or extremely difficult to understand.
I believe that one of the selling points of GraphQL is that you only fetch the data you ask for in queries - so this would suggest that there should be some way of fetching data from a database for only the fields requested - so if I ask for just 2 fields in an object the query only needs to fetch those 2 fields.
I'm not sure if that is possible with this library - I'm finding it very difficult to use and I don't understand the docs much - I've built a graphQL library in Ruby before but this is the first time attempting in rust and this library works completely differently to the Ruby one.
I've also looked at Juniper - but it seems this library was forked from Juniper so has all the same understandability and usage issues I'm struggling with here.
If anyone has managed to create a GraphQL API based on data in a database using this library - please let me know how you did it and point me to any examples (preferably easy to understand ones for a rust beginner)
The text was updated successfully, but these errors were encountered:
Check out the Seaography project with its source code. They build a dynamic GraphQL schema based on SQL schema definitions, and proxy incoming requests to the database.
Speaking about optimizations, async-graphql provides utilities to retrieve requested set of fields. Having them, you may call .select_only() and .select_columns() methods of SeaORM, which will pass them to the underlying database driver.
Hi,
I would like to fetch data to populate my GraphQL API from a database. All the examples I found so far were either hardcoded or extremely difficult to understand.
I believe that one of the selling points of GraphQL is that you only fetch the data you ask for in queries - so this would suggest that there should be some way of fetching data from a database for only the fields requested - so if I ask for just 2 fields in an object the query only needs to fetch those 2 fields.
I'm not sure if that is possible with this library - I'm finding it very difficult to use and I don't understand the docs much - I've built a graphQL library in Ruby before but this is the first time attempting in rust and this library works completely differently to the Ruby one.
I've also looked at Juniper - but it seems this library was forked from Juniper so has all the same understandability and usage issues I'm struggling with here.
If anyone has managed to create a GraphQL API based on data in a database using this library - please let me know how you did it and point me to any examples (preferably easy to understand ones for a rust beginner)
The text was updated successfully, but these errors were encountered: