You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "cbertu81@libero.it" <cb...@libero.it> on 2012/11/25 12:21:12 UTC

Generic questions over Cassandra 1.1/1.2

Hi all,
I'm in production with cassandra since version 0.6 then upgraded to 0.7 and 
finally to 1.0.
If I look at my schema now it's "senseless" to be on 1.0 but many things 
changed from 0.6 ... secondary indexes, counters, expiring columns and more.
Now I am going to write a new application using cassandra so I started reading 
documentation in order to "model" the new db using all the new features and not 
reinventing the wheel.

So let's start with couple of questions ... sorry if stupid :-)

1) SCF are deprecated and I see that what it used to be a development concept 
(use a CF and build a row name using ROW+SC name, if you want keep sorting use 
OPP) has become a Cassandra Concept (compund key).
Is it right? And more, can I avoid OPP when using compound keys since inside 
partition key data are ordered on the remaining components of the primary key?

finally  I've tried to use the order by to sort data and it works -- but can I 
use order by and where clause on a secondary index together? 

CREATE TABLE ctable (
    basekey uuid,
    extensionkey uuid,
    myvalue varchar,
    PRIMARY KEY (basekey, extensionkey)
)

 SELECT * FROM ctable WHERE basekey = ?  and myvalue = ? ORDER BY extensionkey 
DESC LIMIT 5
I haven't been able to do it ....

2) Is Cassandra still schemaless? One thing I loved is that to create a new 
column I didn't have to "alter" any cf before. 
Trying CQL 3 I noticed that if I try to make an insert of a new "column" not 
defined in schema I raised an exception. 

Thanks in advance for any help

Carlo





Re: Generic questions over Cassandra 1.1/1.2

Posted by aaron morton <aa...@thelastpickle.com>.
> Now I am going to write a new application using cassandra so I started reading 
> documentation in order to "model" the new db using all the new features and not 
> reinventing the wheel.
Some resources for CQL 3, it may match your needs. If not you can still use Thrift through your favourite client...

There have been a few articles on the DS blog http://www.datastax.com/dev/blog
A talk at the conference by Eric  http://www.datastax.com/events/cassandrasummit2012/presentations
I did a webinar about it last month http://www.datastax.com/resources/webinars/collegecredit

> 1) SCF are deprecated and I see that what it used to be a development concept 
> (use a CF and build a row name using ROW+SC name, if you want keep sorting use 
> OPP) has become a Cassandra Concept (compund key).
Yup (they have not been officially deprecated, it's just recommended that you do not use them). 

> 
> SELECT * FROM ctable WHERE basekey = ?  and myvalue = ? ORDER BY extensionkey 
> DESC LIMIT 5
> I haven't been able to do it ….
That looks ok, what was the error ? 
What cassandra version and what CQL version?
 
> 2) Is Cassandra still schemaless? One thing I loved is that to create a new 
> column I didn't have to "alter" any cf before. 
> Trying CQL 3 I noticed that if I try to make an insert of a new "column" not 
> defined in schema I raised an exception. 
CQL 3 requires a schema, however altering the schema is easier. And in 1.2 will support concurrent schema modifications. 
Thrift API is still schema less. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 26/11/2012, at 12:21 AM, cbertu81@libero.it wrote:

> Hi all,
> I'm in production with cassandra since version 0.6 then upgraded to 0.7 and 
> finally to 1.0.
> If I look at my schema now it's "senseless" to be on 1.0 but many things 
> changed from 0.6 ... secondary indexes, counters, expiring columns and more.
> Now I am going to write a new application using cassandra so I started reading 
> documentation in order to "model" the new db using all the new features and not 
> reinventing the wheel.
> 
> So let's start with couple of questions ... sorry if stupid :-)
> 
> 1) SCF are deprecated and I see that what it used to be a development concept 
> (use a CF and build a row name using ROW+SC name, if you want keep sorting use 
> OPP) has become a Cassandra Concept (compund key).
> Is it right? And more, can I avoid OPP when using compound keys since inside 
> partition key data are ordered on the remaining components of the primary key?
> 
> finally  I've tried to use the order by to sort data and it works -- but can I 
> use order by and where clause on a secondary index together? 
> 
> CREATE TABLE ctable (
>    basekey uuid,
>    extensionkey uuid,
>    myvalue varchar,
>    PRIMARY KEY (basekey, extensionkey)
> )
> 
> SELECT * FROM ctable WHERE basekey = ?  and myvalue = ? ORDER BY extensionkey 
> DESC LIMIT 5
> I haven't been able to do it ....
> 
> 2) Is Cassandra still schemaless? One thing I loved is that to create a new 
> column I didn't have to "alter" any cf before. 
> Trying CQL 3 I noticed that if I try to make an insert of a new "column" not 
> defined in schema I raised an exception. 
> 
> Thanks in advance for any help
> 
> Carlo
> 
> 
> 
>