Waldemar Kornewald on April 01, 2010

SimpleDB backend and JOIN support

Update: Did you fall for it? Looks like small lies are more credible. So, there really is no such backend. But if you want to implement one please read our Writing a non-relational Django backend post.

As you may have noticed, there were no blog posts in the last three weeks (apart from the one yesterday). We hope the waiting was worth it. We've been busy behind the scenes, working together with Mitchell Garnaat from boto (thanks a lot for the help!) to create a SimpleDB backend for Django nonrel.

During that process we also designed a second backend layer which should make writing other non-relational backends much simpler. Basically, all non-relational DBs share some common characteristics, so it would be stupid to make everyone write and understand (!) the complicated code for traversing Django's internal where tree (which represents the query that should be executed). We'll port the App Engine and the (still unfinished) MongoDB backends to that layer later this week. Please contact me if you want to write a backend for the new API. It's mostly a simple Query class which only supports AND and OR rules, but no nested query rules, similar to what PyMongo provides.

Above the second backend layer we'll place the emulation layer we mentioned in earlier blog posts. We've already created a dbproxy backend which takes care of simple JOIN emulation. If you're a SimpleDB user you can already give it a try with this DB configuration in your (you'll need djangotoolbox for this):

    'default': {
        'ENGINE': 'djangotoolbox.dbproxy',
        'TARGET': {
            'ENGINE': 'djangoappengine.db',
            'AWS_ACCESS_KEY': '<your access key>',
            'AWS_SECRET_KEY': '<your secret key>',
            'SUPPORTS_TRANSACTIONS': False,

With this you should be able to run simple JOINs like Profile.objects.filter(user__username='Thomas'). Many-to-many queries are possible, too, now. This opens up many exciting possibilities! Please let us know of any bugs and leave some comments with your experience!