0.0
The project is in a healthy, maintained state
Cassandra DB adapter inspired on Sequel
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 0.8
~> 5.0, < 5.11
~> 0.2
~> 11.0
~> 0.14

Runtime

 Project Readme

CassandraDB

Gem Version CI Coverage Status Code Climate

Cassandra DB adapter inspired on Sequel

Installation

Add this line to your application's Gemfile:

gem 'cassandra_db'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cassandra_db

Usage

Connect

db = CassandraDB.connect hosts: ['localhost'], port: 9042, keyspace: 'system'

Metadata

db.keyspace # => :system

db.keyspaces # => [:system, :system_traces]

db.tables # => Array of table names in current keyspace

Change keyspace

db.use_keyspace 'my_keyspace'
db.keyspace # => :my_keyspace

Create and drop keyspaces

replication_opts = {
  class: 'SimpleStrategy',
  replication_factor: 1
}
db.create_keyspace :my_keyspace, replication: replication_opts, durable_writes: true

db.drop_keyspace :my_keyspace

Queries

dataset = db[table_name] # => CassandraDB::Dataset
dataset = db[table_name].where(field: 'value') # => CassandraDB::Dataset

Dataset/Enumerable methods

dataset.count
dataset.each
dataset.map
dataset.all

Insert, Update, Delete

dataset.insert id: 1, name: 'Name 1'

dataset.where(id: 1).update name: 'Name 2'

dataset.where(id: 1).delete

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/gabynaiman/cassandra_db.

License

The gem is available as open source under the terms of the MIT License.