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.

13 Responses to Database migrations for Cassandra with ActiveColumn

  1. Jared Carroll says:

    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.

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

  3. Gus says:

    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 says:

      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

  4. Bilal Ahmed says:

    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

  5. Bilal Ahmed says:

    Does it support Super columns?

    • Michael Wynholds says:

      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
      
  6. Bilal Ahmed says:

    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 says:

      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

  7. Pingback: Ten Signal Blog | Ten Signal Blog

  8. Pingback: Tensignal Ruby on Rails and Cassandra - Tensignal

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>