views:

119

answers:

1

Hi All,

I have my csv file in my public folder, and i'm trying to load it from a migration, but I get a file not found error using this script :

ActiveRecord::Base.connection.execute(
  "load data local infile '#{RAILS_ROOT}/public/muds_variables.csv' into table muds_variables " +
  "fields terminated by ',' " +
  "lines terminated by '\n' " +
  "(variable_name, definition)")

I've checked and re-checked the file path, and that's definitely where it lives, I've also tried it just using the file name without any of the path, and a few other combos, but I can't make it work :(. can anyone help me out with this?

here's the error : Mysql::Error: File '/home/chris/rails_projects/muds/public/muds_variables.csv' not found (Errcode: 2): load data local infile '/home/chris/rails_projects/muds/public/muds_variables.csv' into table muds_variables fields terminated by ',' lines terminated by ' ' (variable_name, definition)

-C

A: 

the answer, is that this should work if you ACTUALLY have a file named muds_variables.csv my file was named muds variables.csv sorry for the waste :/

Chris Drappier