I have a python dictionary that I would like to store in Google\'s BigTable datastore (it is an attribute in a db.Model
class).
Is there an easy way to do t
I assume that when you need to be able to reach the dict, it's all-at-once? You don't have to get values from inside the dict while it's in the datastore?
If so, you'll have to serialize, but don't have to use pickle; we use simplejson instead. Then retrieving is a simple matter of overriding toBasicType(), sort of like this:
class MyModel(db.Model): #define some properties, including "data" which is a TextProperty containing a biggish dict def toBasicType(self): return {'metadata': self.getMetadata(), 'data': simplejson.loads(self.data)}
Creation involves calling MyModel(...,simplejson.dumps(data),...).
If you're already pickling, that may be your best bet, but simplejson's working pretty well for us.