You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Brian Palmer (JIRA)" <ji...@apache.org> on 2011/06/22 23:50:47 UTC

[jira] [Issue Comment Edited] (CASSANDRA-2500) Ruby dbi client (for CQL) that conforms to AR:ConnectionAdapter

    [ https://issues.apache.org/jira/browse/CASSANDRA-2500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053365#comment-13053365 ] 

Brian Palmer edited comment on CASSANDRA-2500 at 6/22/11 9:50 PM:
------------------------------------------------------------------

Jon,

jbellis asked me to take a quick look at this, but I haven't had much luck so far getting this to work with DBI 0.4.3, ruby 1.8.7, cassandra 0.8.0 on OS X. The short list:

 * ruby syntax error in DBI::DBD::Cass::Database#execute_prepared (missing comma)
 * Cass::Driver calls super with VERSION which is "0.0.0", but DBI is expecting the DBI API version ("0.4.0"), so an exception is thrown on init
 * initializing a new DBI connection fails due to DBI::DBD::Cass::Database#active? not checking if @tconn is nil before calling @tconn.current_server
 * DBI::DBD::Cass::Statement#execute references db, which isn't defined, it probably means to use @db local var
 * After working around the above errors, I get an exception when running a select query like `dbh.execute("select * from users;").fetch` : NoMethodError: undefined method `size' for #<CassandraThrift::CqlRow:0x102badf58>

I'm not entirely sure if any of these last four are issues specific to my environment, but it seems unlikely that they all are. The require statements in Cass.rb definitely need cleaning up as well, but it sounds like that's still an open question. Also, I'd suggest changing all those define_method calls in Cass.rb to normal method definitions just using def, that's very unidiomatic ruby.

      was (Author: codekitchen):
    Jon,

jbellis asked me to take a quick look at this, but I haven't had much luck so far getting this to work with DBI 0.4.3, ruby 1.8.7, cassandra 0.8.0 on OS X. The short list:

 * ruby syntax error in DBI::DBD::Cass::Database#execute_prepared (missing comma)
 * Cass::Driver calls super with VERSION which is "0.0.0", but DBI is expecting the DBI API version ("0.4.0"), so an exception is thrown on init
 * initializing a new DBI connection fails due to DBI::DBD::Cass::Database#active? not checking if @tconn is nil before calling @tconn.current_server
 * DBI::DBD::Cass::Statement#execute references db, which isn't defined, it probably means to use @db local var
 * After working around the above errors, I get an exception when running a select query like `dbh.execute("select * from users;")` : NoMethodError: undefined method `size' for #<CassandraThrift::CqlRow:0x102badf58>

I'm not entirely sure if any of these last four are issues specific to my environment, but it seems unlikely that they all are. The require statements in Cass.rb definitely need cleaning up as well, but it sounds like that's still an open question. Also, I'd suggest changing all those define_method calls in Cass.rb to normal method definitions just using def, that's very unidiomatic ruby.
  
> Ruby dbi client (for CQL) that conforms to AR:ConnectionAdapter
> ---------------------------------------------------------------
>
>                 Key: CASSANDRA-2500
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2500
>             Project: Cassandra
>          Issue Type: Task
>          Components: API
>            Reporter: Jon Hermes
>            Assignee: Pavel Yaskevich
>              Labels: cql
>             Fix For: 0.8.2
>
>         Attachments: 2500.txt, genthriftrb.txt, rbcql-0.0.0.tgz
>
>
> Create a ruby driver for CQL.
> Lacking something standard (such as py-dbapi), going with something common instead -- RoR ActiveRecord Connection Adapter (http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/AbstractAdapter.html).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira