in reply to Re^2: Select DB data into CSV file
in thread Select DB data into CSV file

This is fine until your table outgrows your memory: selectall_arrayref will read all rows into memory and then pass it to csv (), whereas using a fetch handle has virtually no memory overhead.

my $sth = $dbh->prepare ("select * from foo"); $sth->execute; csv (out => "foo.csv", in => sub { $sth->fetch }, undef_str => "\\N");

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^4: Select DB data into CSV file
by 1nickt (Canon) on Dec 20, 2018 at 13:24 UTC

    Yes, understood. That's standard DBI practises ... I'm dealing with a small table, so no memory concerns. Mostly wondering if there was a sugary interface, and more especially, in the context of DBIx::Class.


    The way forward always starts with a minimal test.