Virsandra Build Status Code Climate Dependency Status Coverage Status

The Cassandra backed models with Virtus gem with a stupid name.

Moving target

Virsandra is meant to make it easy to use cassandra for persistence for models build with virtus.

The feature set will likely remain simple, the idea is to not block development of other projects while the implementation of CQL changes quickly.

Schema yourself

At this stage, you're on your own in terms of schema management. The gem expects you to maintain table <=> model attribute mappings yourself.

Example usage

require 'virsandra'

Virsandra.configure |c|
  c.servers = ""
  c.keyspace = "example_keyspace"

To define a Company model backed by a table companies using a composite primary key of name text, founder text:

class Company
  include Virsandra::Model

  attribute :name, String
  attribute :founder, String
  attribute :turnover, Fixnum
  attribute :founded, Date

  table :companies
  key :name, :founder

Create a company:

company = "Gooble",
                      founder: "Larry Brin",
                      turnover: 2000000,
                      founded: 1884)

Find the company by key:

company = Company.find(name: "Gooble", founder: "Larry Brin")

Find or initialize a company. If there is a row with the same primary key, this will load missing attributes from cassandra and merge new ones.

company = Company.load(name: "Gooble", founder: "Larry Brin", foundec: 2012)
#=> {name: "Gooble", founder: "Larry Brin", turnover: 2000000, founded: 2012}

Search for companies:

companies = Companies.all

googbles = Companies.where(name: 'Gooble')

company_names =

TODO / Milestones

Todos are managed with Github issues, hopefully assigned to a milestone.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request