473,915 Members | 4,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to export data from ZODB to text files

ls
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

Jul 19 '05 #1
10 7719
ls wrote:
I looking for help with ZODB data export to text file. I have file
Data.fs
[snip]
Could you point me in to some Python code examples, code contributions
and so on.


You can download the "standalone " ZODB code and run it under regular
Python without Zope installed or involved, and use that to access your
Data.fs file directly. See http://www.zope.org/Products/StandaloneZODB

This page lists much documentation (near the bottom):
http://www.zope.org/Wikis/ZODB/FrontPage

-Peter
Jul 19 '05 #2
ls
Hi Peter,

Thank you for your reply. I already can access file using code

from ZODB import FileStorage, DB
storage = FileStorage.Fil eStorage('mydat abase.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

Jul 19 '05 #3
On Tue, 7 Jun 2005 14:48:34 +0000 (UTC),
l.********@gaze ta-dot-pl.no-spam.invalid (ls) declaimed the following in
comp.lang.pytho n:

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.
I've not looked into ZODB directly, but as I understand it...

ZODB is an object store, so it doesn't really have a "structure"
in terms of RDBM tables. As I understand it, loading "data" from ZODB
creates instances of various classes; you probably (if you don't already
/know/ the nature of the classes) will have to look into each instance
to find the attributes, etc.

-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.com/> <

Jul 19 '05 #4
l.********@gaze ta-dot-pl.no-spam.invalid (ls) writes:
Hi Peter,

Thank you for your reply. I already can access file using code

>>> from ZODB import FileStorage, DB
>>> storage = FileStorage.Fil eStorage('mydat abase.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?


Yes, you do (or hire somebody else who does). I'm afraid you may
really have your work cut out here! It really all depends on the
complexity of your application, and how well it was written. But if
you're shiny-new to Python, Zope, OO databases and all the ideas that
go with these kinds of systems, you may be at the bottom of a longish
ladder -- what's your background? ZODB is relatively simple and
probably has relatively few quirks as OO persistance systems go, but
still, learning ZODB and a new language at the same time might be
confusing (not to mention finding your way around the application
you're working with). And Zope is... complicated.

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?
John
Jul 19 '05 #5
ls
> 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

Jul 19 '05 #6
ls wrote:
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?


The simplest approach is to run Zope with the Data.fs file. 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.
--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science
Jul 19 '05 #7
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:

catalog=context .portal_catalog
jobs=catalog(
{
'meta_type' : 'Internship'
}
)
OID = 1
for metaJob in jobs:
jobData=catalog .getobject(meta Job.data_record _id_)
print "%i|%s|%s|%s|%s |%s|%s|%s|" % \
(OID,
jobData.company Name,
jobData.company Vision,
jobData.descrip tion,
jobData.positio nOffered,
jobData.jobProf ile,
jobData.contact ,
jobData.country )
OID += 1

return printed

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

Regards,
Josef

Jul 19 '05 #8
ls
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.Fil eStorage('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

Jul 19 '05 #9
Hi Lucasz,
Thank you so much. I will ask our Plone administrator to test your
script and I will write about result here. You are wellcome. I think it is one of the easiest way of doing it.
I thought also about Python script like
//connect to database
>>> from ZODB import FileStorage, DB
>>> storage = FileStorage.Fil eStorage('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?

I have to say it would be interesting to do something like that with
ZODB. Specially if you only have the Data.fs and don't have access to
the original Plone site. But I don't know how to do it. You may ask in
the ZODB list:

http://lists.zope.org/mailman/listinfo/zodb-dev

Regards,
Josef

Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
12883
by: atse | last post by:
Hi experts, I retrieve data from the database and display on ASP, then I export these data to a file, like Excel (the best) or text file. Is it possible? I think it is possible, but how can I do that? Thanks for any help. Atse
1
1891
by: Harald Armin Massa | last post by:
Hello, I am using ZODB "standalone" in version 3.3.1 within some application. Now I learn that the 3.3.x branch of ZODB is "retired". No problem so far, everything is running fine. BUT... "retired" gives me the hint that nothing GREAT will be done to this branch anymore :)
1
498
by: Bridget Willey | last post by:
I am using ACT 6 and am trying to "split" the database between records for customers and junk records. The accounts designated as "customers" have that word in the ID field, and I am using that field as a lookup to separate these records from the rest of the database, which have nothing in the ID field. When I try to use the Export Wizard, it does not allow me the option to choose the lookup records to export. It seems to work, but when...
6
13156
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel spreadsheet. I'm having trouble with my code at the point at which it hits ".ReadRecords" -- the module just runs and runs without generating anything. I've gotten this code to correctly save .rpt files without any data, but not with data, nor have I been...
3
4918
by: Jorge Cecílio | last post by:
Hi! I would like to export some MS-Access reports output to pdf. However, the only possibility offered by Access (afaik) for me to export formatted output is snp (snapshot) (I use MS-Office XP Prof. 2002 version). With formatted output I mean the *exactly* output I produce from executing my report (information is gathered from an ODBC database).
6
2517
by: Mudcat | last post by:
Hi, I am trying to build a tool that analyzes stock data. Therefore I am going to download and store quite a vast amount of it. Just for a general number - assuming there are about 7000 listed stocks on the two major markets plus some extras, 255 tradying days a year for 20 years, that is about 36 million entries. Obviously a database is a logical choice for that. However I've never used one, nor do I know what benefits I would get...
5
2658
by: vd12005 | last post by:
Hello, While playing to write an inverted index (see: http://en.wikipedia.org/wiki/Inverted_index), i run out of memory with a classic dict, (i have thousand of documents and millions of terms, stemming or other filtering are not considered, i wanted to understand how to handle GB of text first). I found ZODB and try to use it a bit, but i think i must be misunderstanding how to use it even after reading...
0
993
by: robert | last post by:
I have (large) disk files connected with ZODB objects and want the disk files to be removed when the Python/ZODB object all finalizes. Is it possible to get a kind of reliable __del__ signal for that? Robert
3
7175
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this file but save it as an excel file. The data in this excel file will be imported into an Access database. The
0
9881
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4778
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3368
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.