Search code examples
pythoncassandrapycassa

How do I get all the keys that are stored in the Cassandra column family with pycassa?


Is anyone having experience working with pycassa I have a doubt with it. How do I get all the keys that are stored in the database?

well in this small snippet we need to give the keys in order to get the associated columns (here the keys are 'foo' and 'bar'),that is fine but my requirement is to get all the keys (only keys) at once as Python list or similar data structure.

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

Thanks.


Solution

  • try:

        list(cf.get_range().get_keys())
    

    more good stuff here: http://github.com/vomjom/pycassa