You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by Apache Wiki <wi...@apache.org> on 2011/10/22 23:11:52 UTC

[Cassandra Wiki] Update of "CassandraCli" by DavidAllsopp

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.

The "CassandraCli" page has been changed by DavidAllsopp:
http://wiki.apache.org/cassandra/CassandraCli?action=diff&rev1=37&rev2=38

Comment:
Clarified the need to add key_validation_class for v0.8+

  
  We went on to connect to our local Cassandra node. We created keyspace `Twissandra` and column family `User`. Note that with the column family, we used a UTF8Type comparator.  That means that the columns will be sorted based on UTF8Type sorting.  It also means that when the column names are displayed on the command-line, they will be displayed as UTF8Type (readable) text. For more information and options for creating column families type `help create column family;` on the command line. Finally, we exited from our cli shell.
  
+ ----
- Note: As of Cassandra 0.8, we need to declare a key_validataion_class for the column family:
- {{{ update column family User with key_validation_class=UTF8Type; }}}
  
+ '''Note: As of Cassandra 0.8, values are interpreted as bytes by default, so we will need to declare a key_validation_class for the column family so we can enter text keys:'''
+ 
+ {{{ 
+ update column family User with key_validation_class=UTF8Type; 
+ }}}
+ 
+ or, you can wrap each value to specify how it should be interpreted, e.g:
+ 
+ {{{
+ set User[utf8('jsmith')]['first'] = 'John';
+ }}}
+ 
+ or, you can temporarily `assume` a type (this must be repeated every CLI session)
+ 
+ {{{
+ assume User keys as utf8;
+ set User['jsmith']['first'] = 'John';
+ }}}
+ 
+ ----
  
  Let's get back into the shell with some options specified and create some data. You should be aware that using the right assumption for your column family keys is 'essential' for the CLI to work correctly. None of the data retrieval/manipulation commands will work as expected if the key assumption is wrong. If you are just exploring cassandra from the CLI, you can leave the assumptions at their defaults, though.