forked from apache/cassandra-python-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack_overflow.py
More file actions
31 lines (19 loc) · 792 Bytes
/
stack_overflow.py
File metadata and controls
31 lines (19 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
__author__ = 'gregbestland'
from multiprocessing import Process
from cassandra.cluster import Cluster
from cassandra.query import SimpleStatement
class DataProcess(Process):
def __init__(self):
super(DataProcess, self).__init__()
# Do a few other irrelevant things ...
# Set up the Cassandra connection
self.cluster = Cluster(contact_points=["127.0.0.1"])
self.session = self.cluster.connect('irchelp')
print "Connected to cassandra."
def callback(self):
query = "SELECT * FROM system.local"
statement = SimpleStatement(query)
results = self.session.execute("SELECT * FROM system.local")
print str(results)
cluster = Cluster(contact_points=["127.0.0.1"])
session = cluster.connect('irchelp')