resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)

30 views
Skip to first unread message

amit kolariya

unread,
Apr 20, 2015, 9:22:47 AM4/20/15
to activewareh...@googlegroups.com
When i am trying to run the activewarehouse-etl and i am getting the error

bundle exec etl etl/etl_plan.ctl 
Starting ETL process
initializing ETL engine

/home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:27:in `spec'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/adapter_extensions-1.0.0/lib/adapter_extensions.rb:9:in `establish_connection_with_adapter_extensions'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/execution/base.rb:6:in `<class:Base>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/execution/base.rb:4:in `<module:Execution>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/execution/base.rb:2:in `<module:ETL>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/execution/base.rb:1:in `<top (required)>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/execution.rb:16:in `<top (required)>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/engine.rb:38:in `init'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/commands/etl.rb:79:in `execute'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/lib/etl/commands/etl.rb:90:in `<top (required)>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/gems/activewarehouse-etl-1.0.0/bin/etl:28:in `<top (required)>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/bin/etl:23:in `load'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/bin/etl:23:in `<main>'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/bin/ruby_executable_hooks:15:in `eval'
from /home/asmy/.rvm/gems/ruby-1.9.3-p551@swgem/bin/ruby_executable_hooks:15:in `<main>'

 My etl_plan.ctl files looks like this
 
class EtlPlan < ActiveRecord::Base
 establish_connection :production 
 self.table_name =  'etl_plans'
end


class EtlInfo < ActiveRecord::Base
  establish_connection :production
  self.table_name =  'etl_infos'
end   
 
 a = 0

  if EtlInfo.find_by_table_name("plans")
    a = EtlInfo.find_by_table_name("plans").last_etl_id
  end

 source :input,
  {
  :type => :database,
  :target => :memp_development,
  :table => "plans",
  :query => "select * from (select id , name from plans order by id) where id > #{a}"
  },
  [
    :id,
    :name
  ]


transform(:name) do |n,v,r|
  r[:name]
end

destination :out, {
  :type => :database,
  :target => :production,
  :table => "etl_plans"
},
{
  :primarykey => [:id],
  :order =>[:id,:name]



post_process{
   
  a = EtlPlan.connection.execute("SELECT MAX(ID) FROM ETL_PLANS").fetch[0].to_i
  if !EtlInfo.find_by_id(2)

    EtlInfo.connection.execute("INSERT into etl_infos(id,table_name,last_etl_id,created_at,updated_at) values (2,'plans',#{a},sysdate,sysdate )")
  else 
    EtlInfo.connection.execute("UPDATE etl_infos SET id=2,table_name='plans',last_etl_id=#{a},created_at=sysdate,updated_at=sysdate
    where id = 2 ")
  end

}

When I am running the ctl file in production evn i am getting the above error. Solution will really appreciated. Thanks 


Reply all
Reply to author
Forward
0 new messages