That's interesting.  I haven't looked into custom properties yet, but
it sounds like just what I was after.  By the same approach, I assume
one could easily make a JSONProperty as well...

I'm not very familiar with pickling.  Are there the advantage or
disadvantage to pickle vs. JSON?  Obviously JSON would be easier to
debug and inspect with the Data Viewer.  Does Pickle survive code
changes of the classes it represents?  I see the class name and other
data is present in the pickled form.  Also, are there major speed
differences (I heard that cPickle is not present in GAE -- does this
make for an extra slow pickle?).

Pickle overload: http://docs.python.org/library/pickle.html


On Dec 23, 11:14 pm, Alexander Kojevnikov <[email protected]>
wrote:
> http://is.gd/dgBK
>
> On Dec 24, 5:38 pm, boson <[email protected]> wrote:
>
> > Is there a good way (any way) to hook a db.Model subclass so that it
> > does some magic right before being written to the Datastore, and some
> > reverse magic right when it's read back?
>
> > E.g. Say you want to have a big JSON object stored in a TextProperty.
> > Obviously you could JSON and de-JSON it yourself every time you load
> > or save it.  But ideally you could hook this code into the class
> > itself, so as soon as it's read from the store the JSON string is gone
> > and a Python object is in its place.  Similarly, you could manipulate
> > the Python object and write it back to the store, where it would be
> > quickly re-JSONed prior to hitting BigTable.
>
> > Or maybe there's another better way to work with and serialize
> > arbitrary Python data (lists, dicts, etc.) without writing the code
> > for it in multiple places... Pickle?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to