March 9th, 2010, 07:17 PM
Dumping/Exporting table to a file via Perl DBI
I want to dump a 'select' result of a "Huge" table in to a file (csv or not) using the perl dbi module.
I am in the process of moving all my db calls from system to dbi calls to effectively handle errors and such.. I am stuck on figuring out how to use dbi call effectively to do the below statement.
Currently I am doing it via system call:
I dont want to use the
system("psql -U timadbo -c 'SELECT * FROM $summary;' timadb > $output ");
way bc I believe it will take longer to process than just dumping it directly.
while (@data = $sth->fetchrow_array())
Does anybody have solution or pointer for me on how to export the results to an output file using dbi on postgres?
March 10th, 2010, 03:17 PM
March 11th, 2010, 02:49 PM
Thank you for your answer