anlek / mongify

Mongify allows you to map your data from a sql database and into a mongodb document database.
http://github.com/anlek/mongify
MIT License
317 stars 82 forks source link

Mongify does not work with Postgresql adapter #179

Open nguyenhoangnhon opened 4 years ago

nguyenhoangnhon commented 4 years ago

Hi guys, I am using Mongify to migrate data from PostgreSQL to Mongo DB. When I run command to check PostgreSQL connection , I get a following issue, please help me fix it . My OS is Ubuntu18.04.

lab@lab:~/mongify$ mongify check database.config Traceback (most recent call last): 22: from /usr/local/bin/mongify:23:in

' 21: from /usr/local/bin/mongify:23:inload' 20: from /var/lib/gems/2.5.0/gems/mongify-1.3.2/bin/mongify:17:in <top (required)>' 19: from /var/lib/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/application.rb:28:inexecute!' 18: from /var/lib/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:68:in execute' 17: from /var/lib/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:99:incheck_sql_connection' 16: from /var/lib/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:57:in has_connection?' 15: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_handling.rb:87:inconnection' 14: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_handling.rb:113:in retrieve_connection' 13: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:inretrieve_connection' 12: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in connection' 11: from /usr/lib/ruby/2.5.0/monitor.rb:226:inmon_synchronize' 10: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in block in connection' 9: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:incheckout' 8: from /usr/lib/ruby/2.5.0/monitor.rb:226:in mon_synchronize' 7: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:inblock in checkout' 6: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in acquire_connection' 5: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:incheckout_new_connection' 4: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in new_connection' 3: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/postgresql_adapter.rb:45:inpostgresql_connection' 2: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/postgresql_adapter.rb:45:in new' 1: from /var/lib/gems/2.5.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/postgresqladapter.rb:243:ininitialize' /var/lib/gems/2.5.0/gems/activerecord-### 4.2.11.1/lib/active_record/connection_adapters/postgresql_adapter.rb:652:in `connect': uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::PGconn (NameError)_

anlek commented 4 years ago

@nguyenhoangnhon. See if you can run gem install pg. I believe ActiveRecord uses that gem to make the connection.

nguyenhoangnhon commented 4 years ago

Hi anlek, I run command "gem install pg" but it isn't ok. I checked mongify with mysql2 , it worked fine with mysql2 but with postgesql i get that issue

anlek commented 4 years ago

This might help: https://stackoverflow.com/questions/3116015/how-to-install-postgresqls-pg-gem-on-ubuntu