jasonmk / datastax_rails Goto Github PK
View Code? Open in Web Editor NEWA Ruby-on-Rails interface to Datastax Enterprise. Replaces the majority of ActiveRecord functionality.
License: MIT License
A Ruby-on-Rails interface to Datastax Enterprise. Replaces the majority of ActiveRecord functionality.
License: MIT License
In Cassandra it is possible to define a partition key (the first part of a compound key) of multiple columns. As far as I can find, DatastaxRails only allows one column as a partition key. Since our models sometimes use multiple columns I would love it if DatastaxRails supports this too.
/.rvm/gems/ruby-1.9.3-p484@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/.rvm/gems/ruby-1.9.3-p484/gems/datastax_rails-1.1.0.3/lib/blankslate.rb:27: warning: undefining `object_id' may cause serious problems
rake aborted!
Don't know how to build task 'ds:migrate'
I'm running ruby 2.1.1 and Rails 4.1.0
"rake ds:migrate" (as well as "rails c" etc.) causes
LoadError: cannot load such file -- active_record/deprecated_finders/dynamic_matchers
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/base.rb:6:in 'require'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/base.rb:6:in '[top (required)]'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails.rb:98:in '[top (required)]'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in 'require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in 'block (2 levels) in require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in 'each'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in 'block in require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in 'each'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in 'require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler.rb:131:in 'require'
after installing "activerecord-deprecated_finders" gem, this error happens:
NameError: uninitialized constant ActiveModel::DeprecatedMassAssignmentSecurity
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/attribute_assignment.rb:9:in '[module:AttributeAssignment]'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/attribute_assignment.rb:4:in '[module:DatastaxRails]'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/attribute_assignment.rb:3:in '[top (required)]'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/base.rb:334:in '[class:Base]'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/base.rb:324:in '[module:DatastaxRails]'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/base.rb:10:in '[top (required)]'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails.rb:98:in '[top (required)]'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in 'require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in 'block (2 levels) in require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in 'each'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in 'block in require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in 'each'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in 'require'
/home/antoha/.rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler.rb:131:in 'require'
I tryied to write a boolean column, but got the error (see below). I found that DatastaxRails::Types::BooleanType#encode is responsible for converting all boolean values either to "0" or to "1", so I tried to change
TRUE_VALS.include?(bool) ? '1' : '0'
to
TRUE_VALS.include?(bool) ? true : false
but just got "Invalid STRING constant (false)" instead of "Invalid STRING constant (0)". The root seems to be in cassandra-rb. May be some query sanitizing... I just stopped digging and switched from boolean to varchar :)
CassandraCQL::Error::InvalidRequestException: Invalid STRING constant (0) for checked of type boolean
from /home/antoha/.rvm/gems/ruby-2.1.1/bundler/gems/cassandra-cql-8fb9e0eafdb4/lib/cassandra-cql/database.rb:126:in 'rescue in execute_cql_query'
from /home/antoha/.rvm/gems/ruby-2.1.1/bundler/gems/cassandra-cql-8fb9e0eafdb4/lib/cassandra-cql/database.rb:115:in 'execute_cql_query'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/cql/base.rb:25:in 'execute'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/persistence.rb:124:in 'write_with_cql'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/persistence.rb:70:in 'block (2 levels) in write'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/notifications.rb:161:in 'instrument'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/persistence.rb:66:in 'block in write'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/persistence.rb:65:in 'tap'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/persistence.rb:65:in 'write'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/persistence.rb:247:in '_write'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/persistence.rb:234:in '_create'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/callbacks.rb:33:in 'block in _create'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/callbacks.rb:113:in 'call'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/callbacks.rb:113:in 'call'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/callbacks.rb:166:in 'block in halting'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/callbacks.rb:86:in 'call'
... 13 levels...
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/commands/console.rb:9:in 'start'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:69:in 'console'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in 'run_command!'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/commands.rb:17:in '[top (required)]'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in 'require'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in 'block in require'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in 'load_dependency'
from /home/antoha/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in 'require'
Please add support for the datatype Decimal, which (as far as I can find) is supported in Cassandra (http://docs.datastax.com/en/cql/3.0/cql/cql_reference/cql_data_types_c.html) but not in DatastaxRails.
Cassandra can be protected with a username and password, and the CassandaDriver supports this too (http://datastax.github.io/ruby-driver/api/#methods). Please add support for this.
Hi guys!
I have trouble when trying to save object:
2.1.5 :001 > user = User.new(bio: 'test')
=> #<User id: nil, first_name: nil, user_name: nil, bio: "test", birthdate: nil, active: nil, created_at: nil, updated_at: nil>
2.1.5 :002 > user.save!
fatal: No live threads left. Deadlock?
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/ione-45e1f52da02d/lib/ione/future.rb:667:in `pop'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/ione-45e1f52da02d/lib/ione/future.rb:667:in `value'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/gems/cql-rb-2.0.4/lib/cql/client/client.rb:553:in `block in prepare'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/gems/cql-rb-2.0.4/lib/cql/client.rb:60:in `synchronous_backtrace'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/gems/cql-rb-2.0.4/lib/cql/client/client.rb:553:in `prepare'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/cql/base.rb:42:in `block in execute'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `block in instrument'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `instrument'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/cql/base.rb:29:in `execute'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:154:in `write_with_cql'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:83:in `block (2 levels) in write'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications.rb:166:in `instrument'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:77:in `block in write'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:76:in `tap'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:76:in `write'
... 22 levels...
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /Users/adammarkowski/IdeaProjects/Activiter/bin/rails:8:in `<top (required)>'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /Users/adammarkowski/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/adammarkowski/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'2.1.5 :003 >
This is my User model:
class User < DatastaxRails::Base
uuid :id
string :first_name
string :user_name
text :bio
date :birthdate
boolean :active
timestamps
end
I've set ione and datastax_rails to github repositories at Gemfile, but this didn't change anything at all.
Ruby 2.1.1. Rails 4.1.0. This is a continuation of #17.
I commented out this to see what happens next:
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/attribute_assignment.rb
module DatastaxRails
module AttributeAssignment
extend ActiveSupport::Concern
if Rails.version =~ /^3.*/
include ActiveModel::MassAssignmentSecurity
elsif Rails.version =~ /^4.*/
# include ActiveModel::DeprecatedMassAssignmentSecurity
include ActiveModel::ForbiddenAttributesProtection
end
in this case "rake ds:migrate" causes
rake aborted!
Thrift::ProtocolException: Invalid value of field compression!
/home/antoha/.rvm/gems/ruby-2.1.1/gems/cassandra-cql-1.2.2/vendor/1.2/gen-rb/cassandra.rb:2769:in 'validate'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/thrift-0.8.0/lib/thrift/client.rb:35:in 'write'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/thrift-0.8.0/lib/thrift/client.rb:35:in 'send_message'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/cassandra-cql-1.2.2/vendor/1.2/gen-rb/cassandra.rb:626:in 'send_execute_cql3_query'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/cassandra-cql-1.2.2/vendor/1.2/gen-rb/cassandra.rb:621:in 'execute_cql3_query'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:165:in 'block in handled_proxy'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:146:in 'ensure_socket_alignment'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:165:in 'handled_proxy'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:53:in 'execute_cql3_query'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/cassandra-cql-1.2.2/lib/cassandra-cql/database.rb:117:in 'execute_cql_query'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/cql/base.rb:25:in 'execute'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/schema/cassandra.rb:135:in 'column_family_exists?'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/schema/migrator.rb:71:in 'check_schema_migrations'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/schema/migrator.rb:13:in 'initialize'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/tasks/ds.rake:6:in 'new'
/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/tasks/ds.rake:6:in 'block (2 levels) in [top (required)]'
/home/antoha/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in 'eval'
/home/antoha/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in '[main]'
Tasks: TOP =] ds:migrate =] ds:configure
This code in /home/antoha/.rvm/gems/ruby-2.1.1/gems/cassandra-cql-1.2.2/lib/cassandra-cql/database.rb:117:in `execute_cql_query' is being called twice:
def execute_cql_query(cql, compression=CassandraCQL::Thrift::Compression::NONE)
binding.pry
if use_cql3?
@connection.execute_cql3_query(cql, compression, CassandraCQL::Thrift::ConsistencyLevel::QUORUM) #TODO consistency level
else
@connection.execute_cql_query(cql, compression)
end
rescue CassandraCQL::Thrift::InvalidRequestException
raise Error::InvalidRequestException.new($!.why)
end
I checked in Pry: for the first time value of compression is 2 (integer) and for the second time - {:consistency=>2} and of course that's wrong value:
/home/antoha/.rvm/gems/ruby-2.1.1/gems/cassandra-cql-1.2.2/vendor/0.8/gen-rb/cassandra_types.rb
module Compression
GZIP = 1
NONE = 2
VALUE_MAP = {1 => "GZIP", 2 => "NONE"}
VALID_VALUES = Set.new([GZIP, NONE]).freeze
end
Previous line in backtrace is "/home/antoha/.rvm/gems/ruby-2.1.1/gems/datastax_rails-1.2.3/lib/datastax_rails/cql/base.rb:25:in `execute'":
# Generates the CQL and calls Cassandra to execute it.
# If you are using this outside of Rails, then DatastaxRails::Base.connection must have
# already been set up (Rails does this for you).
def execute
cql = self.to_cql
puts cql if ENV['DEBUG_CQL'] == 'true'
DatastaxRails::Base.connection.execute_cql_query(cql, :consistency => CassandraCQL::Thrift::ConsistencyLevel.const_get(@consistency || 'QUORUM'))
end
Error is that consistency is nil. Shouldn't be passing the hash if consistency is nil.
telnet 54.80.62.209 9160 worked
rake ds:migrate
No live servers in [node0_ip:9160].
tried to use cassandra gem
but had to use
client.disable_node_auto_discovery!
Am I doing something wrong to connect?
Apparently, if you override a list attribute reader to return anything other than the same object, you end up with the previous value after you call save even though the correct value gets saved. Calling reload fixes the issue.
It would be really great if there were a way to have the params yielded to the developer to let them modify as desired.
RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.
via e.g.
spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']
Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.
There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.
I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!
Appendix:
If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies
p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.
Hi, when attempting to use Float's inside Maps, I'm getting the following error:
undefined method 'encode' for 2.107:Float
Are maps not intended to store floats or is this a bug?
I've included the stack trace below, any help you can provide is greatly appreciated.
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/type_converter.rb:322:in `varchar_to_bytes'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/type_converter.rb:76:in `call'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/type_converter.rb:76:in `to_bytes'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/type_converter.rb:62:in `block in to_bytes'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/type_converter.rb:60:in `each'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/type_converter.rb:60:in `to_bytes'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/requests/execute_request.rb:51:in `block in encode_body'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/requests/execute_request.rb:50:in `each'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/requests/execute_request.rb:50:in `each_with_index'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/requests/execute_request.rb:50:in `encode_body'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/protocol/requests/execute_request.rb:15:in `initialize'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/client/asynchronous_prepared_statement.rb:66:in `new'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/client/asynchronous_prepared_statement.rb:66:in `run'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/client/asynchronous_prepared_statement.rb:29:in `execute'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/client/synchronous_prepared_statement.rb:15:in `block in execute'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/client/synchronous_client.rb:8:in `synchronous_backtrace'
# /usr/local/lib/ruby/gems/2.1.0/gems/cql-rb-1.2.2/lib/cql/client/synchronous_prepared_statement.rb:15:in `execute'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/cql/base.rb:34:in `execute'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:108:in `write_with_cql'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:69:in `block (2 levels) in write'
# /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/notifications.rb:161:in `instrument'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:65:in `block in write'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:64:in `tap'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:64:in `write'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:254:in `_write'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:242:in `_create_record'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/callbacks.rb:290:in `block in _create_record'
# /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:82:in `run_callbacks'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/callbacks.rb:290:in `_create_record'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/timestamps.rb:36:in `_create_record'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:235:in `_create_or_update'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/callbacks.rb:286:in `block in _create_or_update'
# /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:113:in `call'
# /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:113:in `call'
# /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:166:in `block in halting'
# /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:86:in `call'
# /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/callbacks.rb:86:in `run_callbacks'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/callbacks.rb:286:in `_create_or_update'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:135:in `save'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/attribute_methods/dirty.rb:15:in `save'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/validations.rb:39:in `save'
# /usr/local/lib/ruby/gems/2.1.0/gems/datastax_rails-2.0.9/lib/datastax_rails/persistence.rb:192:in `update_attributes'
Hi Jason,
first thing tnx for your work, really well done and usefull!
I'm trying to generate a migration but i receive this error:
`require': cannot load such file -- datastax_rails/generators/migration_generator (LoadError)
I see that there's non generator in datastax_rails, i've tried with
rails g migration FooTable (for mysql active record table)
and
rails g datastax_rails:migration CreateFooColumnFamily
But raise the same error.
Tnx in advance
I seem to be having difficulties updating column families that have composite keys. I get the following error:
Missing mandatory PRIMARY KEY part pricing_date
Using CQL_DEBUG
I can see that the query composed is:
UPDATE stock_data SET "price" = ? WHERE id IN (?)
Looking over the documentation for CQL, I believe that it should be something similar to:
UPDATE stock_data SET "price" = ? WHERE id = ? AND pricing_date = ?
The relevant parts from my model are:
class StockData < DatastaxRails::WideStorageModel
self.column_family = 'stock_data'
self.primary_key = :id
self.cluster_by = :pricing_date
self.create_options = 'CLUSTERING ORDER BY (pricing_date DESC)'
uuid :id
time :pricing_date
float price
end
Is this a bug or am I doing something wrong? I am happy to send a PR for a fix if you are able to point me in the right direction.
Hi Jason,
Thanks for this awesome gem. I'm getting a error and i could not figure out whats wrong.
I'm running Ruby 1.9.3p125 and Rails 3.2.8
This is my model:
class User < DatastaxRails::Base
key :uuid
string :name
string :display_name
string :username
text :bio
date :birthdate
boolean :active
timestamps
end
I'm getting the error when I do this:
srikanth@btp8sa42:~/projects/social$ rake ds:schema
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/datastax_rails-1.0.16.3/lib/blankslate.rb:27: warning: undefining object_id' may cause serious problems ** Invoke ds:schema (first_time) ** Invoke ds:configure (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute ds:configure ** Execute ds:schema rake aborted! No definition found that is not part of the PRIMARY KEY /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/cassandra-cql-1.1.3/lib/cassandra-cql/database.rb:101:in
rescue in execute_cql_query'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/cassandra-cql-1.1.3/lib/cassandra-cql/database.rb:99:in execute_cql_query' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/datastax_rails-1.0.16.3/lib/datastax_rails/tasks/column_family.rb:79:in
upload_solr_schemas'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/datastax_rails-1.0.16.3/lib/datastax_rails/tasks/ds.rake:48:in block (2 levels) in <top (required)>' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
call'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in block in execute' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
each'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in execute' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
block in invoke_with_call_chain'
/home/srikanth/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:144:in invoke' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
invoke_task'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block (2 levels) in top_level' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
each'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block in top_level' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:88:in top_level' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
block in run'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
run'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/bin/rake:33:in <top (required)>' /home/srikanth/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in
load'
/home/srikanth/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `
Hi jasonmk, I'd like to be able to search over models using specific fields, although I noticed that in your documentation for the class the :fields
option is not yet implemented. Is this still the case?
Happy to do the work for this if you can point me in the right direction ๐
Hi, we are thinking of moving to Puma and would like to know if datastax_rails is compatible with it? I have had a look in your code and Passenger seems to be supported. We are planning on using something like this, inside Puma on_worker_boot
:
datastax_config = YAML.load ERB.new(Rails.root.join('config',"datastax.yml").read).result(binding)
DatastaxRails::Base.establish_connection(datastax_config[Rails.env].with_indifferent_access)
Also, does DatastaxRails handle connection pools?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.