Here is a snippet out of some of my test code to try, I cut out most of the irrellevant bits, hope it works for you... (the original code worked here.... :-)
TSocket socket = new TSocket("localhost", 9160); TTransport transport; transport = socket; TBinaryProtocol binaryProtocol = new TBinaryProtocol(transport, false, false); Cassandra.Client thriftClient = new Cassandra.Client(binaryProtocol); transport.open(); Set<String> keyspaces = thriftClient.describe_keyspaces(); if (!keyspaces.contains(KEYSPACE)) { List<CfDef> cfDefs = new ArrayList<CfDef>(); thriftClient.system_add_keyspace(new KsDef(KEYSPACE, "org.apache.cassandra.locator.RackUnawareStrategy", 1, cfDefs)); } thriftClient.set_keyspace(KEYSPACE); Map<String, Map<String,String> > cfs=thriftClient.describe_keyspace(KEYSPACE); String columnFamily = "MyCf"; CfDef cfDef = new CfDef(KEYSPACE, columnFamily); cfDef.column_type="Super"; cfDef.comparator_type="TimeUUIDType"; thriftClient.system_add_column_family(cfDef); On Tue, Jul 20, 2010 at 12:48 AM, Gary Dusbabek <gdusba...@gmail.com> wrote: > I just realized that I didn't answer the "how" part of your question. :) > > http://svn.apache.org/repos/asf/cassandra/trunk/contrib/py_stress/stress.py > and > http://svn.apache.org/repos/asf/cassandra/trunk/test/system/__init__.py > both contain examples of how to use the system_* methods to manipulate > keyspaces. > > Gary. > > > On Mon, Jul 19, 2010 at 09:46, Gary Dusbabek <gdusba...@gmail.com> wrote: > > Defining at runtime is, very intentionally, an absolute must. It > > would have been very simple and perhaps user-friendly to add a flag > > that loads the schema specified in yaml when cassandra starts up. I > > decided against it when implementing the feature because I figured it > > would have been a disservice if users were constantly over-writing > > existing schema unintentionally. > > > > Gary. > > > > > > On Mon, Jul 19, 2010 at 08:39, Boris Spasojevic > > <boris.spasoje...@epfl.ch> wrote: > >> Hi all, > >> Can someone post an example of how to define keyspaces in Cassandra 0.7? > >> My initial Cassandra node does not load the keyspaces defined at > >> Cassandra.yaml. Is there a way to define the keyspaces at startup or is > >> runtime defining an absolute must? > >> > >> thanks, > >> BoriS > >> > >> > > >