For a User Entity, I want to create a property that is a dictionary of serialized data. The data is:
time = time_value
name = name_value
id = id_value
Are there existing libraries to support serializing data, including DateTime values, and then deserializing them into their types (like DateTime, String, Integer) when fetching them from the Datastore?
Note: I’m going on the assumption that serializing the data is more efficient than encoding in JSON. If that is a false assumption then this question is a moot.
The built-in Python library
picklecan be used to serialize and deserialize your data (while maintaining type information). You can store the “pickled” data in adb.BlobProperty.Unfortunately, Google App Engine’s uses a Python-only implementation for the
picklelibrary, and does not have support for the much fastercPickle. Based on analysis presented by Konstantin in his article Pickle vs JSON – Which is Faster?, it seems like you can expect to get better performance with JSON in this case.