python fdb save huge data from database to file
Posted
by
peter
on Stack Overflow
See other posts from Stack Overflow
or by peter
Published on 2013-10-20T15:51:05Z
Indexed on
2013/10/20
15:53 UTC
Read the original article
Hit count: 249
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!
© Stack Overflow or respective owner