Databases Reference
In-Depth Information
to work with one NoSQL product is so proprietary that it cannot be used with an alternative
NoSQL product. Application sources that work seamlessly across NoSQL products and with both
SQL and NoSQL products are desirable.
In the NoSQL world the concept of indexes and the ways of joining data sets varies widely from one
product to another. Making Django applications work with multiple NoSQL products involves writing
custom hooks for index management and data aggregation and joins for each NoSQL product.
Last but not least, NoSQL is a popular choice for cloud platforms but portability across these
platforms is a very challenging issue. For example, Google App Engine (GAE) provides a modeling
abstraction on top of the Google Bigtable, whereas Amazon Web Services provides a hosted
document database in SimpleDB. Django applications for the GAE or the Amazon SimpleDB
get tightly coupled to the platform and migrating applications between these two platforms or to
another cloud service provider becomes extremely diffi cult. Sometimes, such moves almost require
a complete rewrite, creating vendor lock-in and increasing costs and effort required for migrating
from one platform to another.
The django-nonrel independent open-source project was put together to address all these issues and
to provide a common level of abstraction for Django to work with multiple NoSQL products. The
project source is available online at https://bitbucket.org/wkornewald/django-nonrel/src .
Waldemar Kornewald and Thomas Wanschik are the creators of and core contributors to this project.
The django-nonrel project patches the core Django distribution only enough to make it work with
databases other than RDBMS. The heavy lifting is done by django-dbindexer, which takes care of
denormalizing and joining data sets in the NoSQL world.
Django-dbindexer is an early stage open-source project. It's hosted online at https://bitbucket
.org/wkornewald/django-dbindexer/src . Django-dbindexer serves as the layer that sits on top
of NoSQL databases. It's the level that takes care of the differences among the NoSQL products,
so case-sensitive queries and support for joins (or the lack of them) is taken care of at this level.
For example, case-insensitive fi lters on MongoDB can't use indexes. Complete scans as opposed to
indexes are ineffi cient. In the django-dbindexer layer, such ineffi cient fi lters can be treated as case-
sensitive fi lters and therefore an index can be leveraged.
The lack of a common powerful query language, like SQL in RDBMS, also poses challenges when
supporting certain queries across NoSQL platforms. Django-dbindexer simplifi es and standardizes
the query API as well. So a workaround code in the GAE as follows:
# models.py:
Available for
download on
Wrox.com
class MyModel(models.Model):
name = models.CharField(max_length=64)
lowercase_name = models.CharField(max_length=64, editable=False)
last_modified = models.DateTimeField(auto_now=True)
month_last_modified = models.IntegerField(editable=False)
def save(self, *args, **kwargs):
self.lowercase_name = self.name.lower()
self.month_last_modified = self.last_modified.month
super(MyModel, self).save(*args, **kwargs)
Search WWH ::




Custom Search