Question about importing in batch

93 views
Skip to first unread message

Jason Green

unread,
Aug 3, 2011, 2:48:40 PM8/3/11
to redbeanphp
I am trying to load an entire csv using redbean. Currently i am using
fgetcsv and looping through each row, creating a bean and using
R::store(). My question is, is there a faster way to do this, maybe
500 rows at a time or something for inserts? If the csv has 10000
rows, it would make 10,000 inserts vs maybe 10 inserts using insert in
batch. Hope you can help.

Jason

gabor

unread,
Aug 7, 2011, 5:02:51 AM8/7/11
to redbeanphp

Hi Jason,

Looping through beans is the only way if you want to use the model
validations. Importing CSV files is outside the scope of RedBeanPHP,
however there seem to be some very nice libraries out there that allow
you to perform very fast CSV imports, like this one:

http://www.phpclasses.org/package/2917-PHP-Import-CSV-data-into-a-MySQL-database-table.html

Cheers,
Gabor

Jason Green

unread,
Aug 9, 2011, 5:24:14 PM8/9/11
to redbeanphp
Thanks. i will check it out.

On Aug 7, 4:02 am, gabor <gabordemo...@gmail.com> wrote:
> Hi Jason,
>
> Looping through beans is the only way if you want to use the model
> validations. Importing CSV files is outside the scope of RedBeanPHP,
> however there seem to be some very nice libraries out there that allow
> you to perform very fast CSV imports, like this one:
>
> http://www.phpclasses.org/package/2917-PHP-Import-CSV-data-into-a-MyS...
Reply all
Reply to author
Forward
0 new messages