Outputting large amounts of rows
asgraf opened this issue · 1 comments
asgraf commented
I would like to generate really big csv files with large amounts of rows.
public function export()
{
$this->viewBuilder()->className('CsvView.Csv');
$milionsOfRows = $this->SomeBigTable->find()->enableBufferedResults(false)->all();
$this->set('data',$milionsOfRows);
$this->set('_serialize','data');
}
Currently this plugin generates complete csv content before outputting it to the browser.
This can cause slowndowns or running out of memory when dealing with big number of rows.
I think it would be good idea to stream csv output instead (and flush() it every 100 rows)
josegonzalez commented
Looks like this is possible as shown here.
Would you be interested in creating a pull request? For large responses, I normally generate on the backend and provide a notification to the user that their response is ready, rather than generate on the fly.
What I'm trying to say is this isn't a problem I have in my applications, so I am unlikely to work on a fix.