public
Created

Pycassa Test

  • Download Gist
gistfile1.py
Python
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
[default@unknown] connect localhost/9160;
Connected to: "Test Cluster" on localhost/9160
[default@unknown] create keyspace Foo;
b2461b50-838a-11e1-0000-242d50cf1ffe
Waiting for schema agreement...
... schemas agree across the cluster
[default@unknown] use Foo;
Authenticated to keyspace: Foo
[default@Foo] CREATE COLUMN FAMILY mycf
... WITH column_type = 'Standard'
... AND comparator = UTF8Type
... AND key_validation_class = TimeUUIDType
... AND column_metadata = [
... {column_name: a, validation_class: IntegerType, index_type: KEYS,
... index_name: a}
... {column_name: b, validation_class: IntegerType, index_type: KEYS,
... index_name: b}
... {column_name: c, validation_class: IntegerType, index_type: KEYS,
... index_name: c }
... {column_name: d, validation_class: UTF8Type, index_type: KEYS,
... index_name: d }
... {column_name: e, validation_class: UTF8Type, index_type: KEYS,
... index_name: e }
... {column_name: f, validation_class: UTF8Type}
... ];
c4110200-838a-11e1-0000-242d50cf1ffe
Waiting for schema agreement...
... schemas agree across the cluster
[default@Foo]
 
~/pycassa $ ./pycassaShell -k Foo
----------------------------------
Cassandra Interactive Python Shell
----------------------------------
Keyspace: Foo
Host: localhost:9160
 
Available ColumnFamily instances:
* MYCF ( mycf )
 
Schema definition tools and cluster information are available through SYSTEM_MANAGER.
 
In [1]: from uuid import uuid1
 
In [2]: MYCF.insert(uuid1(), {'a': 1, 'b': 2, 'c': 3, 'd': 'd', 'e': 'e', 'f': 'f'})
Out[2]: 1334116836032085
 
In [3]:

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.