How to run a sequnce of AQL queries in arangodb

540 Views Asked by At

I am a newbie and trying to get going on ArangoDB.I want to run a batch of AQL queries which would be interdependent on each other. I want to do the same things we do in PL-SQL. I tried clubbing two or more queries in one post/get request through FOXX but didn't work. Can someone suggest me a better way to do this? or a tutorial for this?

1

There are 1 best solutions below

2
On BEST ANSWER

It all depends what is the client accessing the database.

E.g. we are using Java and the java driver to access ArangoDB. Then either transaction call or AQL query with subsequent AQL queries can be made.

The question is, if the AQL queries are interdependent on each other, why whould you run them in one request? How would you get the results of each one?

Take a look at Gremlin language (it is a Graph language), you would find that it uses WebSockets and result of one query is returned in a binary way through WS... Thus batching such queries wouldn't have any sense. (just a note, ArangoDB also has a provider for the Gremlin API).

I expect, if you are accessing ArangoDB through HTTP. And now you are trying to save http requests. If that is the case I would recommend writing your own API layer, which would expose interface, where you would be able to batch the requests. However the API layer would make 2 calls to Arango (e.g. in parallel), getting the results and somehow merging them to the final output.