Skip to content
shorrockin edited this page Sep 14, 2010 · 25 revisions

Cascal Introduction

Cascal is a simple Cassandra library built on the Scala:www.scala-lang.org language that provides a very consistent and simple means by which you can interact with the Cassandra system.

Cascal has several goals including:

  • Construct a way to use the Thrift library in a manner more conducive with the Scala language.
  • Ensure that no Cassandra specific thrift libraries need to be learned or used.
  • Create a type safe model that mimics the Cassandra system while providing various abstractions on top.
  • Built in support for connection Pooling.
  • 100% usable with Maven – No need to hunt down jars.

Installation Instructions

There get Cascal you can either use Maven, or get the sources directly from GitHub and build it yourself. To Use maven you need to first add the shorrockin.com maven repository, then add the dependency. The XML for this is as follows:


  <dependencies>
    <dependency>
      <groupId>com.shorrockin</groupId>
      <artifactId>cascal</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>shorrockin.com</id>
      <name>Shorrockin Repository</name>
      <url>http://maven.shorrockin.com/</url>
    </repository>
  </repositories>

Once you’ve added this to your pom.xml file you should be ready to start using Cascal.

Usage Instructions

Using Cascal is quite simple, you create a path of immutable structures to model what you want to work with, then use this object with a Cascal session to perform a variety of different functions.

Creating Cascal Paths

The Cascal model mirrors the Cassandra data model with several supertypes on top to identify common features across constructs. While familiarity with Cassandra will help with Cascal usage, it is not required. The terms objects referenced within this document are:

  • Keyspace: If you consider Cassandra as a 4 or 5 dimensional map, the Keyspace is the first dimension of this map.
  • ColumnFamily: If you continue to think of Cassandra as a map, the column ColumnFamily can be thought of as the 2nd dimension of the map.
    • StandardColumnFamily: column families come in two types. A standard column family is used when you wish to model a 4 dimension map. That is a map which follows Keyspace → StandardColumnFamily → StandardKey → Column.
    • SuperColumnFamily: the second type of column family. A super column family is used when you wish to model a 5 dimension map. That is a map which follows Keyspace → SuperColumnFamily → SuperKey → SuperColumn → Column.
  • Key: a key is the 3rd dimension of our map. It is a string identifier which maps to either a Column or a SuperColumn depending on the family in which its used.
    • StandardKey: a generalization of a Key that is used in a StandardColumnFamily.
    • SuperKey: a generalization of a Key that is used in SuperColumnFamily.
  • Column: the 4th (if used in a StandardColumnFamily) or 5th (if used in a SuperColumnFamily) dimension of the hash. Contains a name, value, and timestamp.
  • SuperColumn: if using a SuperColumnFamily the super column is the 4th dimension of the hash. Contains many ordered according to the Cassandra order configuration.
  • ColumnContainer: a categorization type which is that the object holds some typ of Column, is either a Key (standard or super) or a Supercolumn.
Clone this wiki locally