Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `more_results' for #<Mysql> #9

Open
agrobertson opened this issue Jul 18, 2011 · 6 comments
Open

undefined method `more_results' for #<Mysql> #9

agrobertson opened this issue Jul 18, 2011 · 6 comments

Comments

@agrobertson
Copy link

I'm starting to test the Ensembl API, on OS X 10.6.8, using ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.4.0]. I'm reasonably experienced in Ruby but not in Rails.

I just installed the v1.0.1 API gem and tried to run this:

require 'ensembl'
include Ensembl::Core
DBConnection.connect('homo_sapiens',60)

After a few seconds pause at the DBConnection line, I get this error message:

undefined method more_results' for #<Mysql> /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:279:inselect_rows'
...(more error lines, but essentially the same message as above)...

I've likely made some basic error in the setup. Could I ask for help in understanding and resolving the error?

Thank you.

Gordon

@agrobertson
Copy link
Author

On the chance that the error could be resolved by updating activerecord, I just did this and still see the error:

undefined method more_results' for #<Mysql> /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/mysql_adapter.rb:279:inselect_rows'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/database_statements.rb:27:in select_values' /usr/local/lib/ruby/gems/1.8/gems/ruby-ensembl-api-1.0.1/lib/ensembl/db_connection.rb:62:inget_name_from_db'
/usr/local/lib/ruby/gems/1.8/gems/ruby-ensembl-api-1.0.1/lib/ensembl/db_connection.rb:100:in generic_connect' /usr/local/lib/ruby/gems/1.8/gems/ruby-ensembl-api-1.0.1/lib/ensembl/db_connection.rb:140:inconnect'
/Users/grobertson/GENEREG/WORK/svn/GSC_PERSONAL/ENSEMBL/RUBY_API/ensembl_ruby_api_test.rb:28
/usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/mysql_adapter.rb:279:in select_rows': undefined methodmore_results' for # (NoMethodError)
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/database_statements.rb:27:in select_values' from /usr/local/lib/ruby/gems/1.8/gems/ruby-ensembl-api-1.0.1/lib/ensembl/db_connection.rb:62:inget_name_from_db'
from /usr/local/lib/ruby/gems/1.8/gems/ruby-ensembl-api-1.0.1/lib/ensembl/db_connection.rb:100:in generic_connect' from /usr/local/lib/ruby/gems/1.8/gems/ruby-ensembl-api-1.0.1/lib/ensembl/db_connection.rb:140:inconnect'
from /Users/grobertson/GENEREG/WORK/svn/GSC_PERSONAL/ENSEMBL/RUBY_API/ensembl_ruby_api_test.rb:28

Thanks for any help you can offer to understand this error.

Gordon

@jandot
Copy link
Owner

jandot commented Jul 18, 2011

Hi Gordon,

There's no clear cause that pops to my mind right now. Could you try and run the following little script? It just creates an ActiveRecord connection and see if it works.

require 'rubygems'
require 'active_record'
require 'yaml'

ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'ensembldb.ensembl.org',
:port => 5306,
:username => 'anonymous',
:database => 'homo_sapiens_core_60_37e')

class CoordSystem < ActiveRecord::Base
self.pluralize_table_names = false
end

puts CoordSystem.all.to_yaml

@agrobertson
Copy link
Author

Thanks, Jan

When I run the script, I get the following.

undefined method more_results' for #<Mysql> /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/mysql_adapter.rb:637:inselect'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in select_all' /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/query_cache.rb:56:inselect_all'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:473:in find_by_sql' /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/relation.rb:64:into_a'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:143:in all' /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:444:insend'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:444:in all' /Users/grobertson/GENEREG/WORK/svn/GSC_PERSONAL/ENSEMBL/test_ensembl_api.20110718.rb:16 /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/mysql_adapter.rb:637:inselect': undefined method more_results' for #<Mysql> (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/database_statements.rb:7:inselect_all'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/query_cache.rb:56:in select_all' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:473:infind_by_sql'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/relation.rb:64:in to_a' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:143:inall'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:444:in __send__' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:444:inall'
from /Users/grobertson/GENEREG/WORK/svn/GSC_PERSONAL/ENSEMBL/test_ensembl_api.20110718.rb:16

@agrobertson
Copy link
Author

There may be a problem in my Ruby MySQL adapter. I'll look into this today and will get back to you.

@agrobertson
Copy link
Author

Jan

I upgraded to OSX 10.7 (Lion), then went back over Ruby and MySQL installs, following web advice and deleting a couple of years of old installations of both (e.g. from /opt/local...). I reinstalled the Ruby-MySQL gem, then ran two of the test scripts from http://www.kitebird.com/articles/. I reinstalled the Ensembl-API-1.0.1 gem, and started to test basic Ensembl API commands in IRB. I could step through getting a connection, and retrieving a slice, then all genes for that slice, etc. At this point, I ran the test that you'd suggested on 18 July:


Hi Gordon,

There's no clear cause that pops to my mind right now. Could you try and run the following little script? It just creates an ActiveRecord connection and see if it works.

require 'rubygems'
require 'active_record'
require 'yaml'

ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'ensembldb.ensembl.org',
:port => 5306,
:username => 'anonymous',
:database => 'homo_sapiens_core_60_37e')

class CoordSystem < ActiveRecord::Base
self.pluralize_table_names = false
end

puts CoordSystem.all.to_yaml

---end of Jan's test---

grobertson:RUBY_API grobertson$ ruby jans_test.18july2011.rb

  • !ruby/object:CoordSystem
    attributes:
    name: contig
    attrib: default_version,sequence_level
    coord_system_id: "1"
    rank: "4"
    version:
    species_id: "1"
    attributes_cache: {}

    changed_attributes: {}

    destroyed: false
    marked_for_destruction: false
    new_record: false
    previously_changed: {}

    destroyed: false
    marked_for_destruction: false
    new_record: false
    previously_changed: {}

    readonly: false


The problem that I had likely was caused by conflicting installations. I'll continue to work with the Ensembl API, and will let you know if I have more problems.

Thanks for your patience.

@agrobertson
Copy link
Author

In the above comment, I'd cut out most of the ~145-line output written by your test script, but what I removed has been reformatted by the Wiki so that it's not clear that I did this.
G

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants