Skip to content

Instantly share code, notes, and snippets.

@thobbs
Created February 4, 2013 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thobbs/4710022 to your computer and use it in GitHub Desktop.
Save thobbs/4710022 to your computer and use it in GitHub Desktop.
~/pycassa (master)$ ./pycassaShell -k Keyspace1
----------------------------------
Cassandra Interactive Python Shell
----------------------------------
Keyspace: Keyspace1
Host: localhost:9160
Available ColumnFamily instances:
* CF1 ( CF1 )
Schema definition tools and cluster information are available through SYSTEM_MANAGER.
In [1]: import random
In [2]: import string
In [3]: key = ''.join([random.choice(string.ascii_uppercase + string.digits) for x in range(100)])
In [4]: CF1.insert(key, {"col": "val"})
Out[4]: 1360014434309055
In [5]: CF1.get(key)
Out[5]: OrderedDict([('col', 'val')])
In [6]: CF1.remove(key)
Out[6]: 1360014443916222
In [7]: CF1.get(key)
---------------------------------------------------------------------------
NotFoundException Traceback (most recent call last)
/Users/thobbs/pycassa/pycassaShell in <module>()
----> 1 CF1.get(key)
/Users/thobbs/pycassa/pycassa/columnfamily.pyc in get(self, key, columns, column_start, column_finish, column_reversed, column_count, include_timestamp, super_column, read_consistency_level)
653
654 if len(list_col_or_super) == 0:
--> 655 raise NotFoundException()
656 return self._cosc_to_dict(list_col_or_super, include_timestamp)
657
NotFoundException: NotFoundException(_message=None)
In [8]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment