Permalink
Browse files

Linkage and better examples for pycassaShell

  • Loading branch information...
1 parent 5465606 commit ce6197c9e18db823944a5ea02328b0ac28d354e9 @thobbs thobbs committed Oct 4, 2010
Showing with 19 additions and 7 deletions.
  1. +2 −0 doc/installation.rst
  2. +17 −7 doc/pycassa_shell.rst
View
@@ -1,3 +1,5 @@
+.. _installing:
+
Installing
==========
View
@@ -7,6 +7,8 @@ Requirements
------------
Python 2.4 or later is required.
+Make sure you have **pycassa** installed as shown in :ref:`installing`.
+
It is **strongly** recommended that you have
`IPython <http://ipython.scipy.org/moin/>`_, an enhanced interactive
python shell, installed. This gives you tab completion, colors, and working
@@ -41,21 +43,29 @@ The available options are:
* ``-F``, ``--framed`` - Use a streaming transport. Works with Cassandra 0.7.x. This is the default.
Once connected, the client is available as ``CLIENT``. This can be used as you
-would typically use a **pycassa** connection. For example:
+would typically use a **pycassa** connection.
+
+For working with data in Cassandra, check out :mod:`~pycassa.columnfamily`. As
+shown in the example below, once you make a :class:`~pycassa.columnfamily.ColumnFamily`
+object, its easy to insert and retrieve data from Cassandra.
.. code-block:: python
>>> column_family = pycassa.ColumnFamily(CLIENT, 'Standard1')
>>> column_family.insert('key', {'colname': 'val'})
1286048238391943
- >>> CLIENT.describe_keyspace('Keyspace1')
- KsDef(strategy_options=None, cf_defs=[CfDef(comment='', min_compaction_threshold=4, name='SuperLongSubInt', column_type='Super', preload_row_cache=False, key_cache_size=200000.0, gc_grace_seconds=0, column_metadata=[], keyspace='Keyspace1', default_validation_class='org.apache.cassandra.db.marshal.BytesType', max_compaction_threshold=32, subcomparator_type='org.apache.cassandra.db.marshal.IntegerType', read_repair_chance=1.0, comparator_type='org.apache.cassandra.db.marshal.LongType', id=1021, row_cache_size=0.0)], strategy_class='org.apache.cassandra.locator.SimpleStrategy', name='Keyspace1', replication_factor=1)
-
-For working with data in Cassandra, check out :mod:`~pycassa.columnfamily`. As
-shown in the example, once you make a :class:`~pycassa.columnfamily.ColumnFamily`
-object, its easy to insert and retrieve data from Cassandra.
+ >>> column_family.get('key')
+ {'colname': 'val'}
If you are interested in the keyspace and column family definitions,
the :meth:`system_*()` calls are also availble directly on ``CLIENT``.
These allow you to create, drop, or edit keyspaces and column families,
although they are not very friendly to use.
+
+.. code-block:: python
+
+ >>> CLIENT.describe_keyspace('Keyspace1')
+ KsDef(strategy_options=None, cf_defs=[CfDef(comment='', min_compaction_threshold=4, name='SuperLongSubInt', column_type='Super', preload_row_cache=False, key_cache_size=200000.0, gc_grace_seconds=0, column_metadata=[], keyspace='Keyspace1', default_validation_class='org.apache.cassandra.db.marshal.BytesType', max_compaction_threshold=32, subcomparator_type='org.apache.cassandra.db.marshal.IntegerType', read_repair_chance=1.0, comparator_type='org.apache.cassandra.db.marshal.LongType', id=1021, row_cache_size=0.0)], strategy_class='org.apache.cassandra.locator.SimpleStrategy', name='Keyspace1', replication_factor=1)
+ >>> CLIENT.system_rename_keyspace('Keyspace1', 'NewKeyspaceName')
+ '6e8504ff-d001-11df-a513-e700f669bcfc'
+

0 comments on commit ce6197c

Please sign in to comment.