Skip to content

Instantly share code, notes, and snippets.

@thobbs
Created April 11, 2012 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thobbs/2356773 to your computer and use it in GitHub Desktop.
Save thobbs/2356773 to your computer and use it in GitHub Desktop.
Pycassa Test
[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]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment