I have a rather large legacy dataset thats not already in SQL, is there anyway I can use Rails to import this data programmaticly? Im already considering converting the database to Rails code so that it (rails) can handle the relationships (inserts in to join tables and such). Perhaps something very similar to the scaffolding code, but more along the lines of Rails tests? Does this make sense? Can someone provide me with some tips/info/examples for doing such? Maybe there is even a rails plugin? or ruby gem? Thanks in advance. -- Posted via http://www.ruby-forum.com/.
Perhaps my question was a bit vague, or because it likely encompasses a large variety of solutions and hacks and the import script isnt really a functional part of the Rails app, I guess I can understand the lack of answers. I think writing a ruby script that uses ActiveRecord (for handling associations) might be the way to go. Jonathon Marshall wrote:> I have a rather large legacy dataset thats not already in SQL, is there > anyway I can use Rails to import this data programmaticly? Im already > considering converting the database to Rails code so that it (rails) can > handle the relationships (inserts in to join tables and such). Perhaps > something very similar to the scaffolding code, but more along the lines > of Rails tests? > > Does this make sense? Can someone provide me with some > tips/info/examples for doing such? Maybe there is even a rails plugin? > or ruby gem? > > Thanks in advance.-- Posted via http://www.ruby-forum.com/.
On 3-aug-2006, at 20:32, Jonathon Marshall wrote:> Perhaps my question was a bit vague, or because it likely > encompasses a > large variety of solutions and hacks and the import script isnt > really a > functional part of the Rails app,Write it as a a migration. -- Julian ''Julik'' Tarkhanov please send all personal mail to me at julik.nl
hi, 2006/8/3, Jonathon Marshall <jwm@1101001.com>:> I have a rather large legacy dataset thats not already in SQL, is there > anyway I can use Rails to import this data programmaticly?It depends... you don''t say in which format it is, if it''s mappable (more or less easily) into tables/relationships. If it comes in some sort of text file you may use ruby to process those building (and executing) the migrations dynamically (or using ActiveRecord). Another way might be transforming it in YAML and loading it as a fixture... HTH Luca