incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filippo Diotalevi <>
Subject Re: Query
Date Wed, 06 Jun 2012 08:57:45 GMT
the Javadoc (or source code) of the me.prettyprint.hector.api.factory.HFactory class contains
all the examples to create keyspaces and column families.

To create a keyspace:

String testKeyspace = "testKeyspace"; 
KeyspaceDefinition newKeyspace = HFactory.createKeyspaceDefinition(testKeyspace);

To create a column family and a keyspace:

String keyspace = "testKeyspace"; 
String column1 = "testcolumn";
ColumnFamilyDefinition columnFamily1 = HFactory.createColumnFamilyDefinition(keyspace, column1);
List<ColumnFamilyDefinition> columns = new ArrayList<ColumnFamilyDefinition>();


KeyspaceDefinition testKeyspace =
HFactory.createKeyspaceDefinition(keyspace, org.apache.cassandra.locator.SimpleStrategy.class.getName(),
1, columns);

Filippo Diotalevi

On Wednesday, 6 June 2012 at 07:05, MOHD ARSHAD SALEEM wrote:

> Hi All,
> I am using Hector client for cassandra . I wanted to know how to create keyspace and
column family using API's to read and write data.
> or  i have to create keyspace and column family manually using command line interface.
> Regards
> Arshad

View raw message