Open soorajshankar opened 6 months ago
Do #1583 and #2657 relate to this proposal?
Do https://github.com/hasura/graphql-engine/issues/1583 and https://github.com/hasura/graphql-engine/issues/2657 relate to this proposal?
While there are similarities between this proposal and #1583, the scope of the problem we address extends further. Proposal #1583 allows you to query data after executing a mutation. In contrast, this proposal not only facilitates querying data after a mutation but also enables passing values from the preceding mutation or query to the subsequent one. This expansion opens up new possibilities for data access, especially when dealing with complex use cases.
This expansion opens up new possibilities for data access, especially when dealing with complex use cases.
One use interesting use case would be filter then group_by.
Currently an SQL function is necessary - this is fine but requires more work/knowledge.
We are looking into how Hasura can provide a framework to perform orchestrations of any kind (across databases, actions, etc). The current thought is to do via easy to use functions in the Typescript connector (these functions essentially represent any query present in your Hasura supergraph). One can now call these functions in any order or chaining.
More on this approach can be tracked in this issue #10247
Chaining GraphQL Queries / Mutations ====================================
Problem
Ability to chain graphql queries/mutations can open up different ways to think about API, right now relationships are the only way to do this, and that can only work with direct field mapping and mapping to an input argument is not possible atm. Currently in these situations, developers make multiple queries from the client to join data which is costly.
Motivation:
Approaches
// variables
Backend-Defined Chaining Logic: This is a thought on top of the first idea - the difference is just that the above logic is stored in the backend (like RESTified endpoints) and executed as a single graphql query.
Extending Relationships : Ability to define relationships from & to generated types (like aggregates, where clause, limit etc.)
How to find products greater than the average price?
can be solved with this.