Thanks Sylvain!
Did try the quotes, and all is OK.

I was planning on replacing some of my pure thrift calls with the cql 
equivalent to make the code more readable. Hence my first shot at cql.

Regards,
Ignace

From: Sylvain Lebresne [mailto:sylv...@datastax.com]
Sent: vrijdag 7 februari 2014 15:08
To: user@cassandra.apache.org
Subject: Re: Thrift execute_cql3_query function seems to require that keyspace 
name is lowercase and is creating keyspaces with a lower case name

On Fri, Feb 7, 2014 at 2:48 PM, Desimpel, Ignace 
<ignace.desim...@nuance.com<mailto:ignace.desim...@nuance.com>> wrote:
Same for the Column Family name. I thought that CQL names were case sensitive.

You though wrong: http://cassandra.apache.org/doc/cql3/CQL.html#identifiers


Also make it impossible to use this interface to query for existing keyspaces 
that were created with thrift interface and that have capitals in the name.

No it doesn't, but you need to double quote your names if you want the case to 
be preserved, i.e. CREATE KEYSPACE "KK1" WITH ... will create a truly uppercase 
keyspace name. Of course, if you only use CQL, there is no real point in 
forcing the case of your identifiers.

--
Sylvain


Did I read it wrongly?

Simple example :

String sCreateKs = "CREATE KEYSPACE KK1 WITH replication = {'class': 
'SimpleStrategy', 'replication_factor' : 1} ";
oCqlResult = 
oCassClt.execute_cql3_query(ByteBuffer.wrap(sCreateKs.getBytes(UTF8)), 
Compression.NONE, ConsistencyLevel.QUORUM);

//This will fail since keyspace was created with a lowercase name!!!
oCassClt.set_keyspace("KK1");

Other example :

String sCreateKs = "CREATE KEYSPACE KK1 WITH replication = {'class': 
'SimpleStrategy', 'replication_factor' : 1} ";
oCqlResult = 
oCassClt.execute_cql3_query(ByteBuffer.wrap(sCreateKs.getBytes(UTF8)), 
Compression.NONE, ConsistencyLevel.QUORUM);

oCassClt.set_keyspace("kk1"); //Must be in lowercase

//Will create a column family with lowercase name cc1 !!!
String sCreateColFam = "CREATE COLUMNFAMILY CC1 ( c1name text PRIMARY KEY)";
oCqlResult = 
oCassClt.execute_cql3_query(ByteBuffer.wrap(sCreateColFam.getBytes(UTF8)), 
Compression.NONE, ConsistencyLevel.QUORUM);

Regards,

Ignace Desimpel

Reply via email to