PDA

View Full Version : How to import csv files as data for bootstrapping and test



maurizi
Jan 23rd, 2011, 02:19 PM
Hello,

I have a bunch of text files (csv files) that should be loaded into a Grails application mainly for bootstrapping and for testing.

What is a good strategy to do this?

I found a xml slurper where the name of it seemed to do this for mxl files. Is there a plugin somewhere to slurp csv data into Grails domain objects and then to database?

Or can I tell hibernate to directly read from a csv file as a second data source and then save into the normal DB (which is htmldb in dev and Oracle in prod)?

Thanks in advance to any hint :)
Mauri

pledbrook
Jan 24th, 2011, 07:56 AM
I've not used it, but you might find this plugin useful:

http://www.grails.org/plugin/csv

maurizi
Jan 26th, 2011, 06:44 AM
That's what I was looking for. It works as expected.:D
Thank you!