Logo F2FInterview

Pycassa Interview Questions

Q   |   QA
‹‹ previous1next ››

easy_install

If you have easy_install installed, you can simply do:

$ easy_install pycassa

This will also install the Thrift python bindings automatically.

Manual Installation

Make sure that you have Thrift’s python bindings installed:

$ easy_install thrift05

You can download a release from github or check out the latest source from github:

$ git clone git://github.com/pycassa/pycassa.git

You can simply copy the pycassa directory into your project, or you can install pycassa system-wide:

$ cd pycassa/
$ sudo python setup.py install

pycassaShell is an interactive Python shell that is included with pycassa. Upon starting, it sets up many of the objects that you typically work with when using pycassa. It provides most of the functionality that cassandra-cli does, but also gives you a full Python environment to work with.

Here’s how to create the keyspace and column family:

import pycassa
from pycassa import system_manager
from pycassa.columnfamily import ColumnFamily

sys = system_manager.SystemManager('localhost:9160')

sys.create_keyspace('Keyspace1', system_manager.SIMPLE_STRATEGY, {'replication_factor': '1'})
sys.create_column_family('Keyspace1', 'ColumnFamily1')

sys.create_index('Keyspace1', 'ColumnFamily1', 'Field1', system_manager.UTF8_TYPE, index_name='unique_index_name')

‹‹ previous1next ››

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: