No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Basic model - wrapper for CQL(Cassandra Query Language) operations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.1.0
~> 1.8.4
~> 3.12

Runtime

 Project Readme

cassandra_complex

Basic model - wrapper for CQL(Cassandra Query Language) operations.

Extern interfaces provided by CassandraModelCql

Table

Class Table implements wrapping of CQL3 operations.

Model

Class Model implements basic model.

Example of usage

Basic configuring

CassandraComplex::Configuration.read({'host'=>'127.0.0.1:9160', 'default_keyspace'=>'cassandra_complex_test'})
CassandraComplex::Configuration.logger = Logger.new(STDOUT)

Using interface provided by CassandraComplex::Table

class Timeline < CassandraComplex::Table
  set_table_name 'timeline'
end
Timeline.create({'user_id' => 'test_user0', 'tweet_id' => 16, 'author' => 'test_author0', 'body' => 'test_body0'})
Timeline.all
Timeline.delete('test_user0')
Timeline.truncate

Using Model interface

class TimelineModel < CassandraComplex::Model
  table 'timeline'
  attribute :user_id,  'varchar'
  attribute :tweet_id, 'int'
  attribute :author,   'varchar'
  attribute :body,     'varchar'
  primary_key :user_id, :tweet_id
end
Timeline.create_table
timeline1 = TimelineModel.new({'user_id' => 'test_user1', 'tweet_id' => 1, 'author' => 'test_author1', 'body' => 'test_body1'})
timeline1.author = 'test_author42'
timeline1.dirty? == true
timeline1.save
timeline1.dirty? == false
Timeline.drop_table

Features

  • Wrapping all CQL3 operations, no need to write any CQL3 code.

  • Model provides basic model with dirtiness.

  • All selects, such as .all, .find, count returns arrays of pure hashes.

  • All other operations return true if success or false otherwise.

  • You can iterate through result row at moment it being fetched from Cassandra.

  • You can execute any operation within context of Table.with_keyspace.

  • All connections operations to each keyspace is protected with mutex.