Active Record streaming/Enumerable results

Hi,
I have come to conclusion that Active Record cannot stream, or enumerate
over rows; this I base on the contract with Connection Adapters that
always
return arrays of hashes – all rows from the query (with regards to
:limit
and other similar options). In other words I didn’t find any way for
Connection Adapter to return an Enumerable (or similar) that fetches the
next row from the database on demand – in fact streaming the results of
a
query.

I understand that there is support for batch in ActiveRecord::Batches
but
that is not the same as on demand streaming of results. Interesting work
on
this has been done for PostgreSQL in
https://github.com/zoocasa/activerecord-postgresql-cursors.

Are there any plans for more general inclusion of cursors / streaming
results in Active Record? Can anyone suggest an alternative?

thanks,

Zoran

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs