zdennis / activerecord-import

A library for bulk insertion of data into your database using ActiveRecord.
http://www.continuousthinking.com
MIT License
4.03k stars 618 forks source link

OracleEnhancedAdapter connection.instance_variable_get :@config #9

Closed vhochstein closed 13 years ago

vhochstein commented 13 years ago

it seems gem is nt working with activerecord oracleEnhanced Adapter.

Im getting a nil exception in self.load_from_connection(connection), cause @config instance variable is nt defined in connection class, which leads to a nil exception in: require_adapter config[:adapter]

My question: There is no special Import oracle Adapter at all in gem, is it save to just skip requiring a special one for oracle, or is a db specific adapter a must for your gem to work?

zdennis commented 13 years ago

I do not use Oracle and the kind gentle soul who did and made sure the gem/plugin worked with Oracle has moved on, so I removed the Oracle adapter from the code-base.

It appears that require_adapter should not fail (but just use the fallback import capabilities) if no db-specific adapter is found rather than die violently.

Would you mind replacing the self.require_adapter method in activerecord-import/lib/activerecord-import/base.rb to the following:

 def self.require_adapter(adapter)
  require File.join(AdapterPath,"/abstract_adapter")
  path = File.join(AdapterPath,"/#{adapter}_adapter")
  if File.exists?("#{path}.rb")
    require File.join(AdapterPath,"/#{adapter}_adapter")
  end
end

If that works for you I'll release a new update. Thanks,

vhochstein commented 13 years ago

you need to do some additional changes in self.load_from_connection

require_adapter(config.nil? ? nil : config[:adapter]) cause it is nt guaranteed that @config is defined in connection class.

and react to nil in require_adapter accordingly...

It s a pity that your oracle guy has moved on. :-( Will see what happens...

zdennis commented 13 years ago

We can probably get this working for Oracle again. My problem last time was that I had no way to run import tests against Oracle so I could never be sure if anything broke. If you have the ability to run Oracle tests or help me get a VM set up running Oracle lite I'd be more than happy to add it back in.

vhochstein commented 13 years ago

I would say that preferred solution would be to get you up and running. So far I did not work with oracle lite, but I know Oracle full client and instant client. I think we will be able to get you up and running. I was nt able so far to test oracle import, cause I m currently in the process of upgrading my first application to rails 3 and I have nt reached to the import stuff so far. :-(

zdennis commented 13 years ago

@vhochstein, I'm probably not going to use Oracle any time soon. If you are interested or know of anyone who is, I'd be happy to accept patches and spend a little bit of time getting an environment set up to run Oracle tests, but for the near-term I don't see me spending time on it. too many other things to do with tools I use daily. Keep me posted. Thanks,

kristyan commented 13 years ago

Hi,

I got the same error when running passenger/rails 3/ruby 1.9.1 against mysql.

Has this happened before for mysql?

Here is my gem list

* LOCAL GEMS *

abstract (1.0.0) actionmailer (3.0.3, 2.3.8, 2.3.5) actionpack (3.0.3, 2.3.8, 2.3.5) activemodel (3.0.3) activerecord (3.0.3, 2.3.8, 2.3.5) activeresource (3.0.3, 2.3.8, 2.3.5) activesupport (3.0.3, 2.3.8, 2.3.5) acts-as-taggable-on (2.0.6) anthonygarcia-db2s3 (0.4.1) anthonygarcia-mailfactory (1.4.2) arel (2.0.6) arrayfields (4.7.4) aws-s3 (0.6.2) bj (1.0.1) builder (3.0.0, 2.1.2) bundler (1.0.10, 1.0.7) bunny (0.6.0) calendar_date_select (1.16.1) cap_gun (0.2.4) capistrano (2.5.19) cgi_multipart_eof_fix (2.5.0) chardet (0.9.0) chef (0.9.12) daemon-spawn (0.2.0) daemon_controller (0.2.5) daemons (1.1.0) delayed_job (1.8.4) elif (0.1.0) erubis (2.6.6, 2.6.5) eventmachine (0.12.10) eventmachine_httpserver (0.2.0) exceptional (2.0.10) extlib (0.9.15) eycap (0.5.2) faker (0.3.1) fastercsv (1.5.1) fastthread (1.0.7) fattr (2.1.0) file-tail (1.0.5) gem_plugin (0.2.3) geoip (0.8.8) geokit (1.5.0) highline (1.6.1) hodel_3000_compliant_logger (0.1.0) hoe (2.6.2) hpricot (0.8.2) html5 (0.10.0) i18n (0.5.0) json (1.4.6, 1.2.4) json_pure (1.4.6) kgio (2.0.0) machinist (1.0.6) mail (2.2.14, 2.2.13, 2.2.12) main (4.2.0) mime-types (1.16) mixlib-authentication (1.1.4) mixlib-cli (1.2.0) mixlib-config (1.1.2) mixlib-log (1.2.0) moneta (0.6.0) mongrel (1.1.5) mongrel_cluster (1.0.5) mysql (2.8.1) net-scp (1.0.4) net-sftp (2.0.5) net-ssh (2.0.23) net-ssh-gateway (1.0.1) newrelic_rpm (2.13.2) ohai (0.5.8) oink (0.1.2) orderedhash (0.0.6) paperclip (2.3.1.1) passenger (3.0.2) polyglot (0.3.1) rack (1.2.1, 1.1.0, 1.0.1) rack-mount (0.6.13) rack-test (0.5.7, 0.5.6) rails (3.0.3, 2.3.8, 2.3.5) railties (3.0.3) rake (0.8.7) rcov (0.9.8) RedCloth (4.2.2) redgreen (1.2.2) rest-client (1.6.1) rmagick (2.12.2) rr (1.0.0) ruby-prof (0.8.1) ruby-smpp (0.2.1) rubyforge (2.0.4) rubygems-update (1.4.1) scout (5.1.4) shoulda (2.10.2) slim-attributes (0.7.6) spruz (0.2.2) systemu (1.2.0) thor (0.14.6) timeliness (0.3.3) treetop (1.4.9) tzinfo (0.3.23) unicorn (3.1.0) uuidtools (2.1.1) will_paginate (2.3.11) xml-simple (1.0.12)