Vicky
2007-Oct-09 22:41 UTC
Loading multiple csv files and adding fields on to an existing table by finding the id
There are many, many files. These files are all in text files and I have been successfully using ''FasterCSV'' but there are so many files. What would be the way to 1. Schools Table exists id 1 sch_id 0998711 name Cudahy H.S. address 1411 S. 21st city Cudahy state WI zip 53110 In a separate file: school id, email address, latitude coord., longitude coord., total num enrollment, total num teachers How would I go about adding the other values to the pre-existing table? Could I do this through ROR? If yes, how would I code that to work with FasterCSV? 2. The second question is about the grades and years. If there are files like Sch_id Grade Year Math-Adv Math-Prof. Math-Basic Math- Min Sample file 1: 0998711 grade 3 2007 40 8 24 6 2 5 9 4 Sample file 2: 0998711 grade 6 2004 55 12 28 8 7 10 3 3 Sample file 3: 0000022 grade 7 2002 Would it be best to create a Grade_Year table for each one, (ie GR03_2007, GR06_2004) or to have a GR03, GR04 and then put the year as a field in the table? Or should I create a table with all the results for that school Table: 0998711_Scores 2007 field Year Gr03 , field Grade, 40 8 Would I be better off just loading this data into MySQL and not through migrations? 3. If I could concatonate the table name with the key to the school (see above 0998711_Scores) would this be a bad idea? Or to really concatonate it even more like (0998711_Gr03_2007). Does anyone have any great ideas on how I should go about doing this? Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---