cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rubbish me <>
Subject Thrift -> CQL
Date Wed, 26 Mar 2014 13:41:17 GMT
Hi all,
We have been using Cassandra for more than 3 years and now we have a cluster in production
still running on 1.1.x contains dynamic-columned column-families - with hector as client.

We are trying to update to the latest 1.2.x and considering to use datastax client in order
to utilise some of its round robin / failover goodness.
We bumped on to a few walls however when converting our thrift based client code to CQL. 
We read through the docs + datastax dev blog entires like: this and this.  However they are
mostly focus on reading from an existing dynamic cf, run some alter table statements, and
reading it again.
Very little about how to insert / update.
So there comes my questions:
-  Is there any way to do insert / update at all on a good old wide cf using CQL?   Based
on what we read back out, we have tried:

INSERT INTO cf_name(key, column1, value) VALUES (‘key1’, ‘columnName1’,’columnValue2’)

But we ended up with “Unknown identifier column1”
-  About read -  One of our cf is defined with a secondary index.  So the schema looks something
create column family cf_with_index
  with column_type = 'Standard'
  and comparator = 'UTF8Type'
  and default_validation_class = 'UTF8Type'
  and key_validation_class = 'UTF8Type'
  and column_metadata = [
    {column_name : 'indexed_column',
    validation_class : UTF8Type,
    index_name : 'column_idx',
    index_type : 0}];
When reading from cli, we will see all columns, data as you expected:
RowKey: rowkey1
=> (name=c1, value=v1, timestamp=xxx, ttl=604800)
=> (name=c2, value=v2, timestamp=xxx, ttl=604800)
=> (name=c3, value=v3, timestamp=xxx, ttl=604800)
=> (name=indexed_column, value=value1, timestamp=xxx, ttl=604800)
However when we Query via CQL, we only get the indexed column:
SELECT * FROM cf_with_index WHERE key = ‘rowkey1’;
key       | indexed_column
rowkey1   | value1
Any way to get the rest?
-  Obtaining TTL and writetime on these wide rows  - we tried:
SELECT key, column1, value, writetime(value), ttl(value) FROM cf LIMIT 1;
It works, but a bit clumsy.  Is there a better way?
-  We can live with thrift.  Is there any way / plan to let us to execute thrift with datastax
driver?  Hector seems not active anymore.
Many thanks in advanced,

View raw message