anlek/mongify

Error while running on windows

Opened this issue · 5 comments

I'm trying to run mongify check database.config
and getting this:

Traceback (most recent call last):
        20: from C:/Ruby27-x64/bin/mongify:23:in `<main>'
        19: from C:/Ruby27-x64/bin/mongify:23:in `load'
        18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mongify-1.3.2/bin/mongify:12:in `<top (required)>'
        17: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        16: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mongify-1.3.2/lib/mongify/cli.rb:1:in `<top (required)>'
        14: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        13: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mongify-1.3.2/lib/mongify.rb:5:in `<top (required)>'
        11: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        10: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
         9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-4.2.11.1/lib/active_support/core_ext.rb:1:in `<top (required)>'
         8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-4.2.11.1/lib/active_support/core_ext.rb:1:in `each'
         7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-4.2.11.1/lib/active_support/core_ext.rb:2:in `block in <top (required)>'
         6: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
         5: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
         4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-4.2.11.1/lib/active_support/core_ext/object.rb:3:in `<top (required)>'
         3: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
         2: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
         1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-4.2.11.1/lib/active_support/core_ext/object/duplicable.rb:106:in `<top (required)>'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-4.2.11.1/lib/active_support/core_ext/object/duplicable.rb:111:in `<class:BigDecimal>': undefined method `new' for BigDecimal:Class (NoMethodE
anlek commented

Hello @arthurvaverko, this is because Rails 4.2 will not run on Ruby 2.7. Try downgrading your ruby version to 2.4.
More details...

Let me know if you still have issues

thansk .. im kinda new to ruby ..

so i moved to using a docker file ..
created this ...

FROM ruby:2.4
LABEL MAINTAINER="Arthur Vaverk <ArthurVaverko@gmail.com>"

RUN gem install activerecord -v 4.2 && \
    gem install activesupport -v 4.2 && \
    gem install bson -v 1.10.2 && \
    gem install bson_ext -v 1.10.2 && \
    gem install highline -v 1.6.1 && \
    gem install mongo -v 1.10.2 && \
    gem install mysql2 -v 0.3.21  && \
    gem install mongify -v 1.3.0 && \
    gem install mongify-mongoid -v 1.0.4
    
RUN apt update && apt install wget && \
    apt install build-essential && \
    apt install libc6-dev
RUN gem install tiny_tds -v 0.7.0

RUN mkdir -p /mongify
WORKDIR /mongify
CMD ["mongify", "-h"]

and my database.config file is

sql_connection do
  adapter   "tiny_tds"
  host      "10.10.10.10"
  username  "sa"
  password  "password"
  database  "Users"
end

mongodb_connection do
  host      "localhost"
  database  "Users"
end

I'm trying to use tiny_tds to get data form MS Sql Server..

and i run the dockerfile like this

docker run --rm --network host -v c:\code\mongify:/mongify/ -it mongify mongify check database.config

and getting a new error

C:\code\mongify>docker run --rm --network host -v C:\Code\mongify:/mongify/ -it mongify mongify check database.config
/usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
/usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
         ... 4442 levels...
        from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/local/bundle/gems/mongify-1.3.0/bin/mongify:10:in `<top (required)>'
        from /usr/local/bundle/bin/mongify:23:in `load'
        from /usr/local/bundle/bin/mongify:23:in `<main>'
anlek commented

Try rolling the Ruby version back a bit more. Maybe 2.2?

I'll run your docker setup when I get some time to check it out.

after rolling too 2.2 im getting this

root@docker-desktop:/mongify# mongify check database.config 
/usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require': Could not load 'active_record/connection_adapters/tiny_tds_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)
        from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
        from /usr/local/bundle/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:175:in `spec'
        from /usr/local/bundle/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:50:in `establish_connection'
        from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/database/sql_connection.rb:40:in `setup_connection_adapter'
        from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/database/sql_connection.rb:56:in `has_connection?'
        from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/cli/command/worker.rb:95:in `check_sql_connection'
        from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/cli/command/worker.rb:64:in `execute'
        from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/cli/application.rb:28:in `execute!'
        from /usr/local/bundle/gems/mongify-1.3.0/bin/mongify:15:in `<top (required)>'
        from /usr/local/bundle/bin/mongify:23:in `load'
        from /usr/local/bundle/bin/mongify:23:in `<main>'

if tiny_tds is not supported any way to migrate from ms sql server to mongo using this tool ?

anlek commented

Your error now is related to using tiny_tds.
I believe you have to install the following gems (inside your container):

gem install tiny_tds 
gem install activerecord-sqlserver-adapter

More details are available here: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter