Mar 10, 2010, 11:16 AM
Post #1 of 4
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.
Currently 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.
For now its doing it via system call:
system("psql -U timadbo -c 'SELECT * FROM $summary;' timadb > $output ");
I dont want to use the fethrow b/c 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?