views:

228

answers:

4

Given that gae & django persistence layers are quite similar, I'm wondering whether someone has tried creating a wrapper? Say, could be useful for utilizing django.forms.ModelForm. Are there any fundamental problems with this?

A: 

What, you mean like the Google App Engine Helper or Google App Engine Patch?

Daniel Roseman
Nope. Neither replaces Django models - just everything else.
Nick Johnson
+2  A: 

App-engine-helper provides limited support for this, but you're still dealing with thinly-disguised App Engine models. I'm not hugely familiar with Django's model framework, but the basic issue is that Django's model framework is simply too tied to relational databases to easily move to the App Engine backend.

You can use a variant of ModelForms, built right into the App Engine SDK, though - see here for details.

Nick Johnson
A: 

The design of Django models implicitly assumes that you're using a relational database. Unfortunately, Datastore does not support all the features of a relational database. For example, there is no equivalent of a join query in Datastore. General transactions aren't supported either. As such, it would be really hard (if not impossible) to adapt Datastore to work as a drop-in replacement for Django models.

At 4:45 of this YouTube video, Guido Von Rossum briefly describes how you need to rethink the way you design your database to fit Datastore's model. The benefit is that you will be able to scale up very well. At 48:30, someone asks why the Datastore API wasn't designed to be more like Django models. Guido explains that the fundamental differences between Datastore and a relational database make this impractical. 13:20 also discusses this.

allyourcode
A: 

Django norel is better alternative to app-engine-helper. It is a much better abstraction that supports django queries (well many of them -- there is no JOIN support), foregin keys (no ManyToMany relations, though).

Django norel supports admin app (app-engine-patch doesn't).

jb