tirumaraiselvan / graphql-engine

Blazing fast, instant realtime GraphQL APIs on Postgres with fine grained access control
https://hasura.io
Apache License 2.0
2 stars 0 forks source link

rethink insertBatchResults function #38

Open tirumaraiselvan opened 5 years ago

tirumaraiselvan commented 5 years ago

User are facing issues in the join function.

I'm having issues with remote joins Specifically no remote objects left for joining at I can confirm the request is beign sent to my remote schema correctly, so it seems the issue is the handling of the response by hasura.

When using Remote joins, I get this error "message": "no remote objects left for joining at {\"descriptionRich\":\"# F&C\"}":thinking:

tirumaraiselvan commented 5 years ago

Current logic is as follows which relies on the following invariant

  1. Remote relationship field can only occur at the leaf of the query structure.
  2. Remote query is aliased according to the order of the hasura result set i.e "remote_result_1" will be the result for "hasura_result_1" where "hasura_result_1" is the first leaf field which contains the remote field.

Algo:

Sort all remote results by their alias. Call this array: remote_results

Traverse hasura json depth first
     When hit a leaf field
        If its array type, extract len(array) remote results from the head of remote_results
        If its object type, extract one remote result  from the head of remote_results