stripe-archive / mosql

MongoDB → PostgreSQL streaming replication
MIT License
1.62k stars 224 forks source link

NoMethod Error #99

Open akinokaze opened 9 years ago

akinokaze commented 9 years ago

Getting a NoMethod error on initial run. Any ideas?

mosql -c /etc/mosql/collections.yml --mongo mongodb://ip/test --sql postgres://host/test

/usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/schema.rb:83:in 'block (2 levels) in create_schema': undefined method '[]' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/schema.rb:80:in 'each' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/schema.rb:80:in 'block in create_schema' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/schema.rb:79:in 'each' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/schema.rb:79:in 'create_schema' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/streamer.rb:90:in 'initial_import' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/streamer.rb:28:in 'import' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/cli.rb:167:in 'run' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/lib/mosql/cli.rb:16:in 'run' from /usr/local/lib/ruby/gems/2.0.0/gems/mosql-0.4.3/bin/mosql:5:in '<top (required)>' from /usr/local/bin/mosql:23:in 'load' from /usr/local/bin/mosql:23:in '<main>'

mayatskiy commented 9 years ago

+1

tbatchelli commented 9 years ago

I had this issue and it was caused by missing meta-table, e.g.:

staging-bookings:
  bookings:
    :meta:
      :table: bookings
    :columns:
      ...

the documentation is not clear in that this is needed, or there is a bug somewhere, but adding this metadata made it all work.

joanrodriguez commented 8 years ago

This did the trick for me, documentation unclear indeed

GMolini commented 8 years ago

That did the trick for me too. Thanks!