Differences between revisions 18 and 19
Revision 18 as of 2013-05-19 04:18:46
Size: 1525
Revision 19 as of 2013-11-15 18:11:52
Size: 1586
Editor: 50
Comment: statcounter
Deletions are marked like this. Additions are marked like this.
Line 27: Line 27:


The Thrift interface is a legacy API for older clients.

If you are developing such a client with the Thrift API, see API for what data structures and method calls are available, and ThriftExamples for examples.

The purpose of using Thrift in Cassandra was to allow portable (across programming languages) access to the database. Thrift accomplishes this by generated source code for the programming language in question based on a Thrift IDL file describing the service (see here).

Let's see how we can use a generated python client to access Cassandra.

  1. Download Thrift and install it

  2. cd cassandra/interface
  3. thrift -gen py cassandra.thrift
  4. cd gen-py/cassandra

Run the script without arguments to get usage information:

Usage: ./Cassandra-remote [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]

Some examples of setting and getting values:

$ ./Cassandra-remote -h cass-1:9160 insert Keyspace1 eevans "ColumnPath('Standard1', column='fruit')" apple 1 ConsistencyLevel.QUORUM
$ ./Cassandra-remote -h cass-1:9160 get Keyspace1 eevans "ColumnPath('Standard1', column='fruit')" ConsistencyLevel.QUORUM
ColumnOrSuperColumn(column=Column(timestamp=1, name='fruit', value='apple'), super_column=None)


ThriftInterface (last edited 2013-11-15 18:11:52 by 50)