question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow multiple operations to be executed in one call

See original GitHub issue

Today you can only execute 1 operation. The spec says you can only do that but I feel its an unnecessary restriction.

I would like graphql-java to introduce a experimental mode where you can provide a list of operation names to execute

So given this valid query

query Orders {
      orders {
        id
        items {
          name
       }
    }
}

query Billing {
    billing {
        dueDate
        amount
    }
}

We could execute both operations by specify the operation names in the ExecutionInput

    ExecutionInput input = newInput().operations(toList("A","B")).build();

We would retain the current single operation name for backwards compatiblity.

If you did this then you need to get a combined execution result. The names of the operations would be the top level values

   executionResult == {
          "A" : {
              "orders" : [ ...]
          },
         "B" : {
              "billing" : {
                 ...
              }
         }
   }

The errors would be a combined list of executing operation A and then operation B

The operations would be executed in the order specified in the input list

Looking at the scope of changes (and spec enhancement) I think this is a good candidate for some library extension.

This is somewhat inspired from the Sangria implementation here : http://sangria-graphql.org/learn/#batch-executor

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
alexgencocommented, Dec 21, 2018

Just wanted to bump this thread. Any reason not to revive this? We definitely have use cases for performing multiple operations in a single request.

0reactions
andimarekcommented, Jul 19, 2019

closing this for now as multiple queries are not supported by the spec at the moment

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple queries executed in java in single statement
I was wondering if it is possible to execute something like this using JDBC. "SELECT FROM * TABLE;INSERT INTO TABLE;". Yes it is...
Read more >
Executing multiple queries in a single operation in GraphQL
In this case, all queries are combined together, and executed as a single operation. That means that they will reuse their state and...
Read more >
Multiple GraphQL Operations in a Request - Dgraph
Multiple Operations ​​ If a request has two or more operations, then each operation must have a name. A request can only execute...
Read more >
Concurrent function in Power Apps - Microsoft Learn
The Concurrent function allows multiple formulas specified within the same property to be evaluated at the same time if they have connector or ......
Read more >
Executing multiple queries concurrently
Multiple queries can be combined together, and executed as a single operation, reusing their state and their data. In this case, if a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found