#1251 ✓not-applicable
Fred Wu

DataMapper.repository.adapter.query error

Reported by Fred Wu | April 19th, 2010 @ 03:00 AM

So I have to execute the MYSQL's LOAD DATA INFILE query (in a rake task). I have set the variable file_path to the target data file:

  DataMapper.repository.adapter.query(
    "LOAD DATA INFILE '#{file_path}' IGNORE INTO TABLE cities FIELDS TERMINATED BY '\t' ENCLOSED BY '\"';"
  )
  • +++/.bundle/ruby/1.9.1/bundler/gems/rails/activesupport/lib/active_support/whiny_nil.rb:48:in method_missing'
  • +++/.bundle/ruby/1.9.1/bundler/gems/dm-do-adapter/lib/dm-do-adapter/adapter.rb:35:in block in select'
  • +++/.bundle/ruby/1.9.1/bundler/gems/dm-do-adapter/lib/dm-do-adapter/adapter.rb:260:in with_connection'
  • +++/.bundle/ruby/1.9.1/bundler/gems/dm-do-adapter/lib/dm-do-adapter/adapter.rb:33:in select'
  • +++/.bundle/ruby/1.9.1/bundler/gems/dm-corelib/dm-core/support/deprecate.rb:7:in query'
  • ***/lib/tasks/application.rake:107:in import_geo_cities'

A temporary workaround is to use begin/rescue and not rescuing anything, it will absorb the error and the rake task would run successfully (with data successfully imported to the database).

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 21st, 2010 @ 11:53 PM

    • State changed from “new” to “not-applicable”

    The #query method is for retrieving results from the database. You'll want to use the #execute method for things like this.

    Marking this ticket as closed for now, but if that does not solve the problem please reopen the ticket with more details on how to reproduce this issue.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Pages