About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

linux default iconpycassa Publisher's description

pycassa is a python client library for Apache Cassandra

pycassa is a python client library for Apache Cassandra with the following features:

1. Auto-failover for normal or thread-local connections
2. Connection pooling
3. A batch interface
4. A method to map an existing class to a Cassandra column family


If easy_install is available, you can use:

easy_install pycassa

The simplest way to install manually is to copy the pycassa directories to your program. If you want to install, make sure you have thrift installed, and run setup.py as a superuser.

easy_install thrift05
python setup.py install


All functions are documented with docstrings. To read usage documentation, you can use help:

>>> import pycassa
>>> help(pycassa.ColumnFamily.get)

To get a connection pool, pass a Keyspace and an optional list of servers:

>>> pool = pycassa.connect('Keyspace1') # Defaults to connecting to the server at 'localhost:9160'
>>> pool = pycassa.connect('Keyspace1', [''])

See the tutorial for more details.
Basic Usage

To use the standard interface, create a ColumnFamily instance.

>>> pool = pycassa.connect('Keyspace1')
>>> cf = pycassa.ColumnFamily(pool, 'Standard1')
>>> cf.insert('foo', {'column1': 'val1'})
>>> cf.get('foo')
{'column1': 'val1'}

insert() also acts to update values:

>>> cf.insert('foo', {'column1': 'val2'})
>>> cf.get('foo')
{'column1': 'val2'}

You may insert multiple columns at once:

>>> cf.insert('bar', {'column1': 'val3', 'column2': 'val4'})
>>> cf.multiget(['foo', 'bar'])
{'foo': {'column1': 'val2'}, 'bar': {'column1': 'val3', 'column2': 'val4'}}
>>> cf.get_count('bar')

get_range() returns an iterable. Call it with list() to convert it to a list.

>>> list(cf.get_range())
[('bar', {'column1': 'val3', 'column2': 'val4'}), ('foo', {'column1': 'val2'})]
>>> list(cf.get_range(row_count=1))
[('bar', {'column1': 'val3', 'column2': 'val4'})]

You can remove entire keys or just a certain column.

>>> cf.remove('bar', columns=['column1'])
>>> cf.get('bar')
{'column2': 'val4'}
>>> cf.remove('bar')
>>> cf.get('bar')
Traceback (most recent call last):
cassandra.ttypes.NotFoundException: NotFoundException()

System Requirements:

В· Python
Program Release Status: Minor Update
Program Install Support: Install and Uninstall

Is pycassa your software?

Manage your software

Most Popular

linux default icon GDB 7.4
GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it... Read more
linux default icon Coral 0.9.1
Coral is a tool and a development platform to create and transform models and modeling languages.
linux default icon Forum Paid Plus Script 6.1
Forum Paid Pay Per Post Exchange is targeted at forum owners who wish to...
linux default icon sdo 0.6.5
Converts oracle SDO_GEOMETRY objects to WKT and GeoJSON.
linux default icon Get Paid Plus Script 6.1
Get Paid Plus Script

Related Category

» Other (877)
» Tools & Editors (359)
» Web Development (146)