Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how to export data from ZODB to text files

Reply
Thread Tools

how to export data from ZODB to text files

 
 
Josef Meile
Guest
Posts: n/a
 
      06-10-2005
Hi again,

> I thought also about Python script like
>
>
> //connect to database
> >>> from ZODB import FileStorage, DB
> >>> storage = FileStorage.FileStorage('Data.fs')
> >>> db = DB(storage)
> >>> conn = db.open()
> >>> dbroot = conn.root()

I just found an information that may be useful for you:

* ZODB for Python Programmers By Michael Pelletier:
http://www.informit.com/articles/art...p?p=23413&rl=1

* A Simple ZODB viewer in wxPython:
http://aspn.activestate.com/ASPN/Coo.../Recipe/409012

The first link contains some useful examples and explanations. The
second one could help you to see how your zodb is organized. In the
links that Peter post, there is also an useful powerpoint presentation.

According to the first link, the ZODB is a persistent dictionary that
you can access like:

>>> db = DB(storage)
>>> connection = db.open()
>>> root = connection.root()


If I'm not wrong, you could see what objects are in root of your zodb by
doing:

>>> print root.keys()


After that you could get your plone site by doing:

>>> ploneSite = root['ploneFolder']


Where if I'm not wrong, "ploneFolder" may be a key in the root
dictionary. Then if plone is like CMF, it must have a "portal_catalog"
instance in it, so, you can get it by:

>>> catalog = getattr(ploneSite,'portal_catalog',None)


If at this point catalog = None, then you have to print the objects in
the plone site by doing:

>>> print ploneSite.objectIds()


Once you find the catalog object, you could try the script I post before
from the command line.

I haven't tested this, but I hope it helps.

Regards,
Josef Meile

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
ZODB revision Matteo Merli Python 1 07-06-2004 01:25 PM
zodb troubles - seeking advice for app design Diez B. Roggisch Python 3 05-07-2004 06:53 PM
More ZEO/ZODB issues drs Python 0 07-12-2003 12:41 AM
loading objects from ZODB Achim Domma Python 2 07-05-2003 01:26 AM



Advertisments