incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Desimpel, Ignace" <Ignace.Desim...@nuance.com>
Subject RE: Thrift execute_cql3_query function seems to require that keyspace name is lowercase and is creating keyspaces with a lower case name
Date Fri, 07 Feb 2014 14:21:42 GMT
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:sylvain@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.Desimpel@nuance.com<mailto:Ignace.Desimpel@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


Mime
View raw message