Exemple #1
0
 def setUp(self):
     self.cl = CasPanda()
     self.cl.connect()
     super(BaseTestInput, self).setUp()
     cl = CasPanda()
     session = cl.connect()
     session.execute("""CREATE KEYSPACE IF NOT EXISTS tests WITH REPLICATION = { 'class' : 'SimpleStrategy',
                         'replication_factor' : 1 };""")
     session.set_keyspace("tests")
     session.execute("""CREATE TABLE IF NOT EXISTS sold_cars (
         make text,
         state text,
         day timestamp,
         event_time timestamp,
         dealership text,
         salesman text,
         year int,
         account_lead text static,
         distributor_lead text static,
         PRIMARY KEY ((make, state), day, event_time));""")
Exemple #2
0
    def setUp(self):
        self.cl = CasPanda()
        self.session = self.cl.connect()
        self.session.execute(
            """CREATE KEYSPACE IF NOT EXISTS tests WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1 };"""
        )
        self.session.set_keyspace("tests")
        self.session.execute("""CREATE TABLE IF NOT EXISTS tester(
                                    id text PRIMARY KEY,
                                    car text,
                                    color text,
                                    owner text,
                                    passengers set<text>,
                                    data blob
                                );""")

        self.cols = ["id", "car", "color", "owner"]

        super(BaseTestInput, self).setUp()
Exemple #3
0
###################################################
#################[ Script: Example ]################
###################################################
"""
Start a cassandra cluster and demonstrate inserting a CassandraFrame.
"""
from caspanda.bear import CasPanda
from caspanda.bamboo import CassandraFrame

cl = CasPanda()
session = cl.connect()
session.execute(
    """CREATE KEYSPACE IF NOT EXISTS tests WITH REPLICATION = { 'class' : 'SimpleStrategy',
                    'replication_factor' : 1 };""")
session.set_keyspace("tests")
session.execute("""CREATE TABLE IF NOT EXISTS sold_cars (
    make text,
    state text,
    day timestamp,
    event_time timestamp,
    dealership text,
    salesman text,
    year int,
    account_lead text static,
    distributor_lead text static,
    PRIMARY KEY ((make, state), day, event_time));""")
session.execute("""CREATE TABLE IF NOT EXISTS albums(
                       id text PRIMARY KEY,
                       car text,
                       color text,
                       owner text,