retrography / OrientR

A wrapper for OrientDB REST API interface in R
Apache License 2.0
16 stars 3 forks source link

Implement the Command interface #5

Open retrography opened 9 years ago

retrography commented 9 years ago

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

pmig commented 8 years ago

Hi @retrography ,

I see that you already started to implement the command interface in commit https://github.com/retrography/OrientR/commit/168097afbfd0da3711b827b1124574fed7be3c50 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 8 years ago

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 https://github.com/retrography/OrientR/pull/14 ?

retrography commented 8 years ago

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 8 years ago

@retrography thanks for advice I will definitely consider it!

I hope that we can merge these projects together soon!

retrography commented 8 years ago

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.