Question

I Have created a composite keyed Column family in Cassandra using CQL. e.g

    CREATE TABLE timeline (
        user_id varchar,
        tweet_id uuid,
        author varchar,
        body varchar,
        PRIMARY KEY (user_id, tweet_id)
    ) with clustering order by (tweet_id desc);

According to the documentation, the first part of composite key is the partition key and the second serves as the sorting value.Now, I want to retrieve say only 5 top columns for a particular key using Pycassa. I have done it using Datastax java Driver but i want to do it in Pycassa. Any suggestions on how to do that ?

Was it helpful?

Solution

For working with CQL, I suggest using the new DataStax Python driver. (Disclosure: I'm the author of the driver as well as the maintainer of pycassa.)

Pycassa only uses the normal Thrift interface, which cannot interact with all types of tables created through CQL, only COMPACT STORAGE stables. You can see more details about Thrift vs CQL3 if you're interested.

Also, I think you'll like the more advanced connection pooling in the new python driver.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top