Schema-less design guidelines for Google App Engine Datastore and other NoSQL DBs
- by jamesaharvey
Coming from a relational database background, as I'm sure many others are, I'm looking for some solid guidelines for setting up / designing my datastore on Google App Engine.  Are there any good rules of thumb people have for setting up these kinds of schema-less data stores?  I understand some of the basics such as denormalizing since you can't do joins, but I was wondering what other recommendations people had.
The particular simple example I am working with concerns storing searches and their results.  For example I have the following 2 models defined in my Google App Engine app using Python:
class Search(db.Model):
    who = db.StringProperty()
    what = db.StringProperty()
    where = db.StringProperty()
    createDate = db.DateTimeProperty(auto_now_add=True)
class SearchResult(db.Model):
    title = db.StringProperty()
    content = db.StringProperty()
    who = db.StringProperty()
    what = db.StringProperty()
    where = db.StringProperty()
    createDate = db.DateTimeProperty(auto_now_add=True)
I'm duplicating a bunch of properties between the models for the sake of denormalization since I can't join Search and SearchResult together.  Does this make sense?  Or should I store a search ID in the SearchResult model and effectively 'join' the 2 models in code when I retrieve them from the datastore?  Please keep in mind that this is a simple example.  Both models will have a lot more properties and the way I'm approaching this right now, I would put any property I put in the Search model in the SearchResult model as well.