retrography/OrientR

Implement the Command interface

Opened this issue · 5 comments

Currently the drivers only handles running idempotent queries. There needs to be an interface for commands as well (exeCommand).

pmig commented

Hi @retrography ,

I see that you already started to implement the command interface in commit 168097a in the dev branch.

Do you have any plans to continue / merge into master?

I would like to implement the command interface to execute idempotent operations.

pmig commented

Hi I see that @mkbouaziz started to implement this feature here: https://github.com/mkbouaziz/OrientR/blob/master/R/orientExeCommand.R

As his repo is more advanced I forked his package and start implementing there. What happend to #14 ?

Hi @pmig!

#14 mainly separates the interface from the implementation, which is a welcome change. @mkbouaziz closed his pull request before I get a chance to accept it. I will if he opens it once more.

But before working further on the "command" interface, consider this: The command interface easily gives you CSVs, which are much easier to handle inside R. Given that the package currently outputs data frames, I do not see why we should go through the added process of JSON conversion inside R. This is slow and error-prone. We can just download CSV and read it into R using the standard interface, instead of using JSON convertors. This reduces our dependency list as well.

Here is a simple REST API request to get CSV from OrientDB:

curl --header "Accept: text/csv" --user admin:admin -d "SELECT * FROM mytable" "http://localhost:2480/command/gems/sql"
pmig commented

@retrography thanks for advice I will definitely consider it!

I hope that we can merge these projects together soon!

Hi again @pmig and @mkbouaziz,

Just to let you know that @jaredlander used to be interested in developing the package further. Maybe you can get some help from him.

Another point on the command interface. As far as I know the command interface allows you to define a fetching strategy. My understanding is that OrientDB's default behaviour is to spool the whole resultset before releasing it to the REST interface. This makes the process of fetching large datasets very slow, sometimes stupidly slow. When developing the command interface, it is important to implement the fetch plans properly upfront. It will save you a lot of work afterwards.

See also #4. It is not fixed yet, and it applies to the command interface as well.