Your suggestion does indeed work perfectly, there is no need to return an
Enumerator.
Many thanks,
Lee
On Monday, 15 August 2016 19:01:28 UTC+1, Lee Smith wrote:
>
> Hi,
>
> I'm using the copy_table method to extract a 1 billion row Postgres table
> to csv in parts. This could be made simpler if copy_table returned an
> Enumerator instead of the entire table contents (if no block is given), as
> I could use the each_slice method.
>
>
> DB.copy_table(:table).each_slice(10000).with_index(1) do |part, part_count|
> File.open(format('%s_%05d.csv', :table, part_count), 'w') do |csv_part|
> part.each do |row|
> csv_part.puts(row)
> end
> end
> end
>
>
>
> Here is a possible implementation
> <https://github.com/LS80/sequel/commit/580bde8f54af0c98e7c5163c392fce027c663c30>
> .
>
> Any thoughts on a change like this?
>
> Regards,
> Lee
>
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.