[lxml-dev] LXML and persistence with the ZODB?

Jim Washington jwashin at vt.edu
Fri Jun 27 18:12:50 CEST 2008


Martijn Faassen wrote:
> Martijn Faassen wrote:
>> Marius Gedminas wrote:
>>> On Thu, Jun 26, 2008 at 04:50:30PM -0500, Kenneth Miller wrote:
>>>> Anyone done anything with this? I know it's simple enough to simply  
>>>> store an XML string, but has anyone bothered with storying lxml objects?
>>> I wouldn't even try.  ZODB is tricky to get right, especially if you're
>>> trying to store mutable objects not designed to be stored in the ZODB.
>>> And if future-compatibility with your old database is important, you
>>> must commit to never renaming a class or an attribute, which is hard to do
>>> when you rely on an external library without such commitment.
>> Actually we're pickling a very well known data structure, XML, not a 
>> tree of elements. You could therefore write a pickler that takes 
>> advantage of this particular property. You'd only worry about the outer 
>> class name at most.
> 
> Checking the lxml.objectify code, it's indeed using this strategy. Since 
> libxml2 serialization and deserialization of XML is pretty fast, this 
> should be okay to use in a pickler.

If you are feeling adventuresome (and don't mind running yet another
server), zif.sedna.sednaobject is also a future possibility.  It's in
alpha release and available at the cheese shop.

http://zif.svn.sourceforge.net/viewvc/zif/zif.sedna/trunk/src/zif/sedna/README_sednaobject.txt?view=markup

- Jim Washington


More information about the lxml-dev mailing list