python fdb save huge data from database to file
- by peter
I have this script
SELECT = """
select
coalesce (p.ID,'') as id,
coalesce (p.name,'') as name,
from TABLE as p
"""
self.cur.execute(SELECT)
for row in self.cur.itermap():
xml +=" <item>\n"
xml +=" <id>" + id + "</id>\n"
xml +=" <name>" + name + "</name>\n"
xml +=" </item>\n\n"
#save xml to file here
f = open...
and I need to save data from huge database to file. There are 10 000s (up to 40000) of items in my database and it takes very long time when script runs (1 hour and more) until finish.
How can I take data I need from database and save it to file "at once"? (as quick as possible? I don't need xml output because I can process data from output on my server later. I just need to do it as quickly as possible. Any idea?)
Many thanks!