Schema-less design guidelines for Google App Engine Datastore and other NoSQL DBs

后端 未结 1 1341
广开言路
广开言路 2021-02-06 01:56

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.

相关标签:
1条回答
  • 2021-02-06 02:26

    Don't duplicate the properties if they'll always be the same between the SearchResult and a Search. If a SearchResult should have a reference to a Search, keep a ReferenceProperty pointing to the Search. This basically stores the related Search's Key in the model.

    class SearchResult(db.Model):
        search = db.ReferenceProperty(Search, required=True)
        # other stuff...
    

    I also highly recommend you watch some of the App Engine videos from last year's Google I/O (and from 2008), in particular this one by Brett Slatkin, and this one by Ryan Barrett. They're all pretty helpful videos if you have the time, but I found those two in particular to be really great.

    0 讨论(0)
提交回复
热议问题