in reply to Re^5: Forking and shelling out to curl
in thread Forking and shelling out to curl

REST::Client, though I just found out it doesn't page data, so I;m back to hitting my head against a wall! :/

Hi,

DBI doesn't page data either :) think about it

Replies are listed 'Best First'.
Re^7: Forking and shelling out to curl
by Corion (Patriarch) on Jan 11, 2020 at 08:04 UTC

    DBI can (somewhat) page data, but of course you can only page forward. The following code fetches the results in batches of 10k rows:

    my $rows = []; # cache for batches of rows while( my $row = ( shift(@$rows) || # get row from cache, or reload +cache: shift(@{$rows=$sth->fetchall_arrayref(undef,10_00 +0)||[]}) ) ) { # do processing of row here ... }

    Of course, just because you're transferring the data from the DB driver to Perl space in batches of 10k doesn't mean that the database driver doesn't fetch all available rows onto your machine already.

    Data::Stream::Bulk wraps this approach in an(other) API, but I never got warm with it.