コード例 #1
0
ファイル: test_describe.py プロジェクト: thompson42/caspanda
class BaseTestInput(unittest.TestCase):
    """
    Base class for input testing.

    Connects to database.
    """
    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));""")
コード例 #2
0
ファイル: test_input.py プロジェクト: thompson42/caspanda
class BaseTestInput(unittest.TestCase):
    """
    Base class for input testing.

    Connects to database.
    """
    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()
コード例 #3
0
ファイル: test_input.py プロジェクト: Accenture/caspanda
    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()
コード例 #4
0
ファイル: example.py プロジェクト: thompson42/caspanda
###################################################
#################[ 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,
コード例 #5
0
ファイル: example.py プロジェクト: Accenture/caspanda
###################################################
#################[ 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,
                       passengers set<text>,