On May 14, 2013, at 12:05 PM, Claudio Freire <klaussfre...@gmail.com> wrote:

> On Tue, May 14, 2013 at 12:38 PM, Michael Bayer
> <mike...@zzzcomputing.com> wrote:
>> storing pickles in the database is an awful idea since your data is now 
>> specific not just to Python but to the current shape of your object model at 
>> a point in time.   Storing JSON is not acceptable for the case where you 
>> need to audit and version each user that has made changes to particular 
>> keys, as well as a history of those changes.
> 
> You could certainly add audit information to the json. Point in case:
> json is functionally equivalent to hstore, so if you were considering
> hstore, you can also use json.


we use JSON where it is expedient, in our case we have UX where users click on 
specific keys, want to see the version history of that key and how it is used 
across versions, so it's appropriate that keys are actual entities.    It's a 
lot less code than working with diffs and is directly queryable with SQL.


> 
> I agree pickle has its issues, not the least of which is security, but
> it's not so specific to Python[0] as it seems, nor is it any more
> dependent of object's structure as your EAV is dependent on attribute
> semantics.

It's not like I have today to argue about this, but I think most people will 
agree the pickle format is a lot less portable than JSON:

>>> d = {"key1": "value1", "key2": "value2"}
>>> import pickle
>>> import json
>>> pickle.dumps(d)
"(dp0\nS'key2'\np1\nS'value2'\np2\nsS'key1'\np3\nS'value1'\np4\ns."
>>> json.dumps(d)
'{"key2": "value2", "key1": "value1"}'
>>> 





> The issues with pickle aren't of that sort, but more of
> security and inconvenience (try reading a pickle from a command line
> database client and you'll want to shoot yourself).
> 
> [0] http://irmen.home.xs4all.nl/pyrolite/
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to