Teach Me To Code » Screencasts
Cassandra Basic Schema and Ruby Gem

Cassandra Basic Schema and Ruby Gem

Teach Me To Code » Screencasts

About this episode

You can get cassandra at cassandra.apache.org and the ruby gem by running:
gem install cassandra
I did run into a problem with the trift_client gem when installing. If you get a Load Error, run this.
sudo chmod 644 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/*.rb
sudo chmod 755 /usr/local/lib/ruby/gems/1.8/gems/thrift_client-0.6.3/lib/thrift_client/connection
Here are some of the Cassandra commands from the video:
#connects to the cassandra server using the Twitter keyspace
store = Cassandra.new(“Twitter”)

create a new column family in the Twitter keyspace called Users

cf_def = CassandraThrift::CfDef.new(:keyspace => “Twitter”, :name => “Users”)
store.add_column_family(cf_def)

add or create a row to the column family

store.insert(“Users”, “cmaxw”, {“name” => “Charles Max Wood”, “description” => “Awesome coder”})

remove a column from a row

store.remove(“Users”, “cmaxw”, “description”)
Download 17.2 MB
Download (iPod & iPhone) 20.9 MB
Take the 2011 Readers Survey

More from Teach Me To Code » Screencasts

My Equipment: Mackie PROFX12 12-Channel Compact Effects Mixer with USB Sony MDR7506 Professional Large Diaphragm Headphone Roland R-05 Studio WAVE/MP3 Recorder Transcend 32 GB Class 10 SDHC Flash Memo…

When preparing to add some layout features to JotRod, I realized it was a Rails 3.0.9 application. Here's a quick rundown on upgrading to Rails 3.1.3. Download 164.7 MB Download (iPod & iPhone) 37.9 M…

In order to get someone a timeline in JotRod, we need followers and following lists to compile the Jots from. This means that we need to add a new ColumnFamily called Followers and another one called…

In the Jots (like tweets) in JotRod, I needed to generate a hash on creation as the key for the Jots. So, I determined that the easiest way to do that was to include ActiveModel Callbacks. The module…

Model Generator

Here's an introduction to creating a Rails connector gem for an ORM with a model generator. Download 352.3 MB Download (iPod & iPhone) 84.7 MB Take the 2011 Readers Survey