Database migrations for Cassandra with ActiveColumn

We at Carbon Five are pleased to announce the release of ActiveColumn – an object mapping framework for Apache Cassandra. Currently at version 0.1.1, this gem is young but functional with its first major feature of data migration support.

Prior to Cassandra 0.7, keyspaces and column families had to be maintained by hand in a configuration file. But starting with version 0.7, these are managed through Cassandra’s Thrift API. ActiveColumn uses this new functionality to deliver data migrations similar to ActiveRecord.

ActiveColumn gives you several tools to help you with your Cassandra data migrations:

  • A Rails generator for creating migration files
rails g active_column:migration CreateUsersColumnFamily
  • Several rake tasks for creating and migrating keyspaces
rake ks:create
rake ks:drop
rake ks:migrate
rake ks:rollback
(and more)
  • Some useful data management functions to use within migrations
class CreateUsersColumnFamily < ActiveColumn::Migration

def self.up
create_column_family :users
end

def self.down
drop_column_family :users
end

end

The gem is pretty well documented on github, so take a look there for further details.

We hope that you find ActiveColumn useful in your Cassandra project. We are dedicated to keeping it under active development, so check back for further updates, give your feedback below, or jump on the project on github and help drive it forward.

Next up: timeline-based data mapping and querying!

About Michael Wynholds

Mike is the President and CEO of Carbon Five.
This entry was posted in Web and tagged , , , . Bookmark the permalink.
  • Jared Carroll

    Very cool stuff Mike. I’m really excited about having a migration system when it comes to cassandra. In my opinion, cassandra 0.7 represents a huge milestone for the project in terms of usability and this gem is a great way for Rails developers to get started experimenting with it.

  • Pingback: Delicious Bookmarks for February 7th from 01:04 to 01:52 « Lâmôlabs

  • Gus

    Hi Mike:

    I am trying to install ActiveColumn but in vaine: https://github.com/carbonfive/active_column the installation never shows that gem installed. I removed Rdoc and yard (all versions) then reinstalled fresh ones then I got the bundle install and gem install work and the gem is there. In irb, I require ‘cassandra/0.7′ and gives me true followed by the ‘active_column’ but always get an error. Any ideas please?

    • Michael Wynholds

      Hi Gus,

      Can you give me a little more detail? You are using Rails 3 and bundler? And you did a ‘bundle install’ successfully? And active_column shows up in a ‘gem list’? What error are you getting, and when is it happening?

      -mike

  • Bilal Ahmed

    Links are broken on github for Migrate, Create and Query

    . Data migrations are very similar to those in ActiveRecord, and are documented in Migrate.
    . Create – how to create data
    . Query – how to find data

    • Michael Wynholds

      If you follow those links from the main page, they are broken. I put a line at the top of the README to make sure to go to the deep link of the README, so that my (relative) links work. That deep link is here:
      https://github.com/carbonfive/active_column/blob/master/README.md

      I’m not sure how to make those links work from the main page, and still make them relative so that I can view the docs locally as well.

  • Bilal Ahmed

    Does it support Super columns?

    • Michael Wynholds

      Hi Bilal-

      Active Column does support super column families for migrations. Making a column family “super” is just a matter of setting some additional properties on it during create. Something like this:

      def self.up
        create_column_family :users do |cf|
          cf.comment = 'Users column family'
          cf.comparator_type = :string
          cf.column_type = 'Super'
          cf.subcomparator_type = :string
        end
      end
      
  • Bilal Ahmed

    Hi Mike,

    Thanks for all the replies and great job in creating ActiveColumn.

    Another question is that, does it support all the methods like fauna/cassandra gem through thrift client? E.g. multi_get, multi_get_coumns, count_columns etc. or I still need to use fauna/cassandra gem…

    Please see this link for reference http://rdoc.info/github/fauna/cassandra/master/Cassandra

    Thanks again.

    • Michael Wynholds

      Hi Bilal-

      Sorry for the late reply. I thought I had responded already but it appears not.

      ActiveColumn requires the Cassandra gem actually, so it supports all of the functionality provided in that gem.

      -mike

  • Pingback: Ten Signal Blog | Ten Signal Blog

  • Pingback: Tensignal Ruby on Rails and Cassandra - Tensignal

  • Pingback: Tensignal Intentando usar la base de datos Cassandra en Rails - Tensignal