Monday, February 18, 2013

arango: ArangoDB Driver for Python (updated Feb 24, 2013)

Past year I've heard about new database - ArangoDB. I was not able to test it using my daily tools - there was no driver for Python. So, I've decided to create it. I've tried to create really good one - high code coverage, well documented and easy API initially was a must.

Yesterday, I've released it - now available on PyPi and on github

Toolchain

Here is list of basic tools which I've used to create the driver

  1. nose - for executing tests, integration and unit. ArangoDB driver contain 103 tests
  2. coverage - to have clear metric how many code lines was covered by tests. Now it's 89%
  3. sphinx - to have good documentation it's a must. Also .. testcode:: and .. doctest :: directives is very useful to keep code examples usable.

Performance

Initially, I've used requests library as main HTTP transport tool. But at some point I've get a letter from ArangoDB team about python driver performance. Here is most important quote:

The guys told me that PHP took 0,5 seconds, JS about a second and our Python script 5 seconds

I've start digging and found that requests is slow. Fast tests shows that urllib2 2x faster than requests, and pycurl 3x faster. Here is performance tests and JS code for arangosh. Below small chart about 1000 documents creation performance



Some details

Installation:
pip install arango

Documentation of the Arango driver for python

ArangoDB official website

Update:: I've improved performance of Arango requests client by using Session Objects. Also updated performance chart.