To store a complex object to Datastore i'm currently using this approach:
class PickleProperty(db.Property):
data_type = db.Blob
def get_value_for_datastore(self, model_instance):
value = self.__get__(model_instance, model_instance.__class__)
if value is not None:
return db.Blob(pickle.dumps(value))
def make_value_from_datastore(self, value):
if value is not None:
return pickle.loads(str(value))
class ComplexModel(db.Model):
data = PickleProperty()
As you know, Google App Engine does not have the more efficient cPickle module; this results in a very slow operation.
Any better strategy?