how to export data from ZODB to text files
Hi All, I looking for help with ZODB data export to text file. I have file Data.fs (file becomes from Plone CMS) and I have to display content structure, data like intro, body of article, etc and save it in to simple file. However I can't use Plone XML export because is broken, Zope Corp. set low priority for this bug, so I have to find other way how to digg in to data. Could you point me in to some Python code examples, code contributions and so on. Thank you for any suggestions, Lukasz -- http://mail.python.org/mailman/listinfo/python-list
re:how to export data from ZODB to text files
Hi Peter,
Thank you for your reply. I already can access file using code
>>> from ZODB import FileStorage, DB
>>> storage =
FileStorage.FileStorage('mydatabase.fs')
>>> db = DB(storage)
>>> connection = db.open()
>>> root = connection.root()
But this is the point where my konwledge ends since I`m not a Python
programmer.
I don`t know what is the structure of ZODB, I`m just looking for code,
or some tool, which I can use to export data from Data.ts file to
plain text file.
I`m looking for easiest way to export data from ZODB and put it to
MySQL later.
Do you know what way I should choose? I have to know Python language
to finish this task?
--
Lukasz
--
http://mail.python.org/mailman/listinfo/python-list
re:how to export data from ZODB to text files
> Why are you doing this in the first place? Trying to escape from > Zope-land? Exporting data on a regular basis, for use in another app? Hi Jonh, Thank you for your reply. 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) Now after your answer, I see that I will be not able to finish this taks by myself ... I'm experienced mostly in C, PHP, also with some backgrounds of CPP and Java, but I'm totaly new in Python ... What do you suggest in this case? -- Lukasz -- http://mail.python.org/mailman/listinfo/python-list
re:how to export data from ZODB to text files
Hi Josef,
Thank you so much. I will ask our Plone administrator to test your
script and I will write about result here.
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()
//here should be interation for DB which saves attributes output in
to file
I'm not able to write the second part, but I think that this shouldn`t
be a problem for experienced Python developer.
How complex will be script like above?
@Max
> If you have access to the zope instance you want to export from, you
only need to write an external method in Zope to export the data you
want. Its pretty easy that way.
Could you contribute code which do export data?
--
Lukasz
--
http://mail.python.org/mailman/listinfo/python-list
