My favorites | Sign in
Project Home Wiki Issues Source
Project Information
Members
Featured
Wiki pages
Links

App Engine Model Plus

App Engine Model Plus is an abstract layer extends db.Model.

What is it?

It keeps the same comportment of db.Model but add a cache layer with memcached. It overrides several methods from db.Model to take it more efficient. App Engine Model Plus helps also to fine tune the comportment of your calls to the datastore. You can configure deadline, retries, and read policy easily.

This project is really young and needs some efforts to test it. Please report any bugs or inconsistencies you observe. Thank you.

Features

  • put/get/delete uses a cache system.
  • Able to configure a default deadline for every api call
  • Able to configure a default retry for every api call
  • prefetch function to retrieve every reference property of a model.
  • serialize/unserialize to convert model in protobuf protocol easily.

About the project

  • To make a clone:
  • git clone https://code.google.com/p/appengine-mp/ 
  • To browse sources:
  • http://code.google.com/p/appengine-mp/source/browse/ 

News

  • 2011-12-15: Add support to mp.put_async() and ModelInstance.put_async() (v0.3).
  • 2011-09-09: Add support to configure deadline and read policy (v0.2).
  • 2011-09-08: First release of development (v0.1).

Quick Install

from google.appengine.ext import db
from libs import mp

class Actor(mp.Model):
  name = db.StringProperty()
  age = db.IntegerProperty()
  father = db.ReferenceProperty(Actor)
  
m = Actor(name="John Doe", age=26)
k = m.put()

# Now when you retrieve it, it comes from memcached not from the datastore.
# To get this example better you can use key_name
# with that the db.Key will be already generate and the App Engine Model Plus can store 
# entity into memcached before the datastore (see: mp/__init__.py#244).
m = mp.get(k)

# An example of the method prefetch.
m.father = Actor(key_name="actor/John Doe Father", 
                 name="John Doe Father", 
                 age=46)
mp.put([m, f])

m = mp.get(k)
m.prefetch() # retrieve every db.ReferenceProperty

Other projects in relation

The documentation is for the moment really bad :) I will work on it.

Powered by Google Project Hosting