문제

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 ?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top