Waldemar Kornewald on October 22, 2010

Cassandra and ElasticSearch backends for Django-nonrel in development

This is a quick update: Rob Vaterlaus has started working on a Cassandra backend and Alberto Paro is working on an ElasticSearch backend for Django-nonrel.

The Cassandra backend is still experimental and lacks support for ListField (from djangotoolbox.fields), but overall it already looks very very interesting. This backend comes with experimental secondary indexes support for Cassandra and requires a recent Cassandra 0.7 build. Secondary indexes allow to efficiently query the DB by attributes other than the primary key which makes Cassandra more similar to App Engine and MongoDB than low-level key-value stores. This feature is disabled, by default, though. Currently, without secondary indexes all queries are filtered in memory. The repository contains the installation instructions, so head over and play with the code, if you're fearless. Keep in mind: it's not production ready and it depends on the latest bleeding-edge Cassandra code. Any help with the backend is highly appreciated.

The ElasticSearch backend is also in alpha state. Not all unit tests pass, yet, and for now it only supports a simple subset of ElasticSearch. Basically, you can use string operations like __contains, __istartswith, __regex and you can compare integers via __gt, __lt, etc. and you can order results. Currently, OR queries are not supported, but Alberto is working on that. He also plans to add support for aggregates! If you want to have a stable and feature-complete backend please grab the source from the repo and contribute. Alberto would be happy to accept patches.

So, we now have backends for App Engine, MongoDB, Cassandra, and ElasticSearch. The first two are stable and get used in production. Who would've thought that Django-nonrel would get this far? That's pretty awesome, isn't it? :) If you want to build some other NoSQL backend please read our post about writing a non-relational Django backend which explains our nonrel backend API. If you need more help please ask on the Django-nonrel discussion group. Now that SimpleDB has a free tier it would be an interesting candidate for Django-nonrel, wouldn't it?