This is how you create it dynamically:
KsDef ksdef = new KsDef();
ksdef.name = "ProgKS";
ksdef.replication_factor = 1;
ksdef.strategy_class =
"org.apache.cassandra.locator.RackUnawareStrategy";
List<CfDef> cfdefs = new ArrayList<CfDef>();
CfDef cfdef1 = new CfDef();
cfdef1.name = "ProgCF1";
cfdef1.keyspace = ksdef.name;
cfdefs.add(cfdef1);
ksdef.cf_defs = cfdefs;
client.system_add_keyspace(ksdef);
CfDef cfdef2 = new CfDef();
cfdef2.keyspace = ksdef.name;
cfdef2.column_type = "Standard";
cfdef2.name = "ProgCF";
client.system_add_column_family(cfdef2);
From: karim abbouh [mailto:karim_rbt@yahoo.fr]
Sent: Friday, May 20, 2011 8:03 AM
To: user@cassandra.apache.org
Subject: Re : Re : selecting data
a storage-conf.xml is read just at the starting of cassandra?
is there a way to add a column family dynamically?
BR
________________________________
De : karim abbouh <karim_rbt@yahoo.fr>
À : user@cassandra.apache.org
Envoyé le : Ven 20 mai 2011, 12h 48min 54s
Objet : Re : selecting data
is there a way to set for a column of the same key a set of value ?
________________________________
De : Watanabe Maki <watanabe.maki@gmail.com>
À : "user@cassandra.apache.org" <user@cassandra.apache.org>
Envoyé le : Jeu 19 mai 2011, 17h 38min 39s
Objet : Re: selecting data
Cassandra is not a RDBMS. Only you can do is search on a key, or you need full scan.
You need to design your schema carefully as your application needs.
On 2011/05/20, at 1:11, karim abbouh <karim_rbt@yahoo.fr> wrote:
i'm new using cassandra database,
i want to get data as in relationnel database:
select * from table where field="value";
i see using CLI we have just the followings commands :
get <ksp>.<cf>['<key>'] Get a slice of
columns.
get <ksp>.<cf>['<key>']['<super>'] Get a slice
of sub columns.
get <ksp>.<cf>['<key>']['<col>'] Get
a column value.
get <ksp>.<cf>['<key>']['<super>']['<col>'] Get
a sub column value.
is there a way for that.
i think using java API is possible.
cassandra version : 6.0.12
thanks for help
|