gregmarra/the-blue-alliance — pull request #254 by gregmarra (2012-10-07 07:12:56+00:00)
Title: Migration to NDB.

A gigantic commit that touches all of the datastore code to move to AppEngine's NDB datastore API. It's important to note that the underlying data structure doesn't change, so no migration is needed.

Putting this up for comments. This branch is running at http://tbatv-dev-hrd.appspot.com/

More information about NDB: https://developers.google.com/appengine/docs/python/ndb/

## My thoughts writing this:
- Our code for many of the basic controllers hasn't been touched in years, and could be improved
- NDB doesn't give you model_set for back references on KeyProperties the way DB did for ReferenceProperties. We could build these back into models like I did with Event.
- NDB has lots of really great async features, including nice Futures, that we should implement
- Some DB interaction is not happening through the "right" channels, as in everything that does a model.put() should be moved to using Manipulators.

## Advantages:
- Free memcache caching of models
- Really nice async and batch stuff
- This appears to be the preferred GAE db library going forward, given it is being developed

## I do not attempt to:
- Rename anything to make more sense.
- We can't rename model keys, for example.
- Holding off on that makes this pull request smaller, and we can rename other things as we go
- Alter any of the techniques we use to retrieve data.
- Many queries could be optimized, or moved into models, or things like that.
- Holding off makes this smaller, and makes breaking anything less likely
- Add more tests
- We really should, though. Fixing all the tests got me 80% to confident that reading and writing worked.