From: "dhaval d." Date: 2012-01-27T10:02:14+09:00 Subject: Cassandra + Ruby Hi, I am new to cassandra and was trying to achieve some simple operations like inserting data into cassandra. I am using cassandra gem to achieve this. client = Cassandra.new('tags_logs', 'ec2-xxx-xxx-xxx.com:9160') client.disable_node_auto_discovery! client.add_column_family(Cassandra::ColumnFamily.new(:keyspace => 'tags_logs', :name => 'impressions')) client.insert(:impressions, "10", {'screen_name' => "john"}) #this worked fine client.get(:impressions, "10") gives me => {"screen_name"=>"john"} as expected. Now when I try to do the following command it gives me error client.insert(:impressions, "10", {"123_sdfsfd_sdfsdf" => {"filename" => "x", "line_count" => 10}}) This line throws an error - TypeError: can't convert Hash into String from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/thrift-0.7.0/lib/thrift/transport/framed_transport.rb:84:in `write' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/thrift-0.7.0/lib/thrift/protocol/binary_protocol.rb:112:in `write_string' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/thrift-0.7.0/lib/thrift/client.rb:35:in `write' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/thrift-0.7.0/lib/thrift/client.rb:35:in `send_message' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/cassandra-0.12.1/vendor/0.8/gen-rb/cassandra.rb:247:in `send_batch_mutate' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/cassandra-0.12.1/vendor/0.8/gen-rb/cassandra.rb:242:in `batch_mutate' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/thrift_client-0.7.0/lib/thrift_client/abstract_thrift_client.rb:131:in `handled_proxy' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/thrift_client-0.7.0/lib/thrift_client/abstract_thrift_client.rb:60:in `batch_mutate' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/cassandra-0.12.1/lib/cassandra/protocol.rb:7:in `_mutate' from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/cassandra-0.12.1/lib/cassandra/cassandra.rb:459:in `insert' from (irb):21 from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `
' -- Posted via http://www.ruby-forum.com/.