python an sqlite objects
bruno.42.desthuilliers at websiteburo.invalid
Wed Dec 3 18:08:09 CET 2008
skip at pobox.com a écrit :
> azrael> is it possible to save a python object into a sqlite database as
> azrael> an atribute of type BLOB
> Sure. Just pickle the object and save the resulting string.
Or if you want something more portable, serialize the object to json. At
least you'll have a chance to deserialize it with some other language.
Now note that using a RDBMS that way kind of defeats the whole point of
using a RDBMS. I don't mean that it's _always_ a bad idea - there are a
couple use case where it's probably the "less worse" thing to do -, but
that one should think twice before doing so.
More information about the Python-list