cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: Thrift -> CQL
Date Wed, 26 Mar 2014 14:27:55 GMT
>
> -  *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"
>

What does cqlsh give you if you try to do 'DESC cf_name'?



>
>
> -  *About read -  One of our cf is defined with a secondary index.  So
> the schema looks something like:*
>
>
>
> 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?
>

You would have to declare the other columns (c1, c2 and c3) in the metadata
(you don't have to index them though).



>
>
> -  *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?*
>

No, it's the CQL way (not that I particularly agree with the "clumsy"
qualification, but I suppose we all have different opinion on what is
clumsy and what is not).


>
>
> -  *We can live with thrift.  Is there any way / plan to let us to
> execute thrift with datastax driver?*
>

No (and it's not like it's a minor change to allow that, the DataStax Java
driver uses the native protocol which is CQL only by nature).

--
Sylvain

Mime
View raw message