Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from thrift import Thrift
- from thrift.transport import TTransport
- from thrift.transport import TSocket
- from thrift.protocol.TBinaryProtocol import TBinaryProtocolAccelerated
- from cassandra import Cassandra
- from cassandra.ttypes import *
- import time, pprint
- socket = TSocket.TSocket("localhost", 9160)
- transport = TTransport.TBufferedTransport(socket)
- protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
- client = Cassandra.Client(protocol)
- pp = pprint.PrettyPrinter(indent = 2)
- keyspace = "Keyspace1"
- key="inmyapp_623219793"
- transport.open()
- column_parent = ColumnParent(column_family="Supern1")
- slice_range = SliceRange(start="", finish="")
- predicate = SlicePredicate(slice_range=slice_range)
- result = client.get_slice(keyspace, key, column_parent, predicate, ConsistencyLevel.ONE);
- pp.pprint(result)
- []
- column_parent = ColumnParent(column_family="Super2", super_column="newsfeed")
- result = client.get_slice(keyspace, key, column_parent, predicate, ConsistencyLevel.ONE);
- pp.pprint(result[0])
- ColumnOrSuperColumn(column=Column(timestamp=1258487318, name='$\xf4\xc50\xd3o\x11\xde\xa8\xad\x000H\x97G\x06', value='{"do": "atta
Add Comment
Please, Sign In to add comment