Apache Cassandra 1.0 Documentation

ASSUME

This document corresponds to an earlier product version. Make sure you are using the version that corresponds to your version.

Latest Cassandra documentation | Earlier Cassandra documentation

Sets the client-side encoding for a cqlsh session.

Synopsis

ASSUME [<keyspace_name>].<columnfamily_name>
       <storage_type_definition>
       [, ...] ;

<storage_type_definition> is:

(KEY | <column_name>) VALUES ARE <datatype>
     | NAMES ARE <datatype>
     | VALUES ARE <datatype>

Description

Cassandra is a schema-optional data model, meaning that column families are not required to have data type information explicitly defined for column names, column values or row key values. When type information is not explicitly defined, and implicit typing cannot be determined, data is displayed as raw hex bytes (blob type), which is not human-readable. The ASSUME command allows you to specify type information for particular column family values passed between the cqlsh client and the Cassandra server.

The name of the column family (and optionally the keyspace) for which to specify assumed types follows the ASSUME keyword. If keyspace is not supplied, the keyspace default is the currently connected one. Next, list the assumed type for column name, preceded by NAMES ARE, then list the assumed type for column values preceded by VALUES ARE

To declare an assumed type for a particular column, such as the row key, use the column family row key name or alias. Alternatively, you can use the KEY keyword to denote the row key if the row key (or any other column) does not have a name or alias defined in the column family schema.

Examples

ASSUME users NAMES ARE text, VALUES are text;
ASSUME users(KEY) VALUES are uuid;
ASSUME users(user_id) VALUES are uuid;