how to export data from ZODB to text files

Josef Meile jmeile at
Wed Jun 8 18:52:44 CEST 2005

Hi Lukasz,

> Yes, I'm traing to escape from Zope-land, to be more clarify I want to
> migrate from Plone to PHP Application, which uses MySQL database
> engine, so I have to move all data from ZODB to MySQL. I suppose that
> python script shouldn`t be so complex. I need just iterate ZODB and
> write attributes like "Intro", "Body" of article to file for example.
> I need export Plone content hierarchy like
> Home
>    |
>    | - - - Folder 1 (Title, Intro, Body)
>    |            | - - - Article (Title, Intro, Body)
>    |   
>    | - - - Folder 2 (Title, Intro, Body)
I haven't done that with Plone, but with CMF, which is the base of
Plone. So, I guess it would be almost the same. You even don't need
the product Peter suggested; you could do a python script inside your
plone site, which searches all the objects you want and print it in
form of a pipe '|' delimited list. Then, once you define your tables
in mysql, you can import the data by copying the output of your
script and saving it into a text file. This is how my script looks like:

               'meta_type'            : 'Internship'
OID = 1
for metaJob in jobs:
   print "%i|%s|%s|%s|%s|%s|%s|%s|" % \
   OID += 1

return printed

Off course, this only work assuming that your fields aren't files like
images or PDFs.


More information about the Python-list mailing list