best Cassandra library/wrapper for Python? [closed]
Asked Answered
L

4

18

I found lazyboy and pycassa - maybe there are others too. I've seen many sites recommending lazyboy. IMHO the project seems dead, see https://www.ohloh.net/p/compare?project_0=pycassa&project_1=lazyboy

So what's the best option for a new project? Thanks.

Latialatices answered 3/5, 2012 at 11:27 Comment(2)
You can try python driver from datastax github.com/datastax/python-driver It seems to be active.Fivestar
I don't think this question is opinion based. It's a question for best practice.Latialatices
B
30

The Cassandra project has been recommending that new projects use CQL for a few versions now, and with the advent of CQL 3 in Cassandra 1.1, I'd definitely recommend going right to that. Advantages include a more familiar syntax if you've used SQL before, and a commonality of interface between the different language CQL drivers. CQL is CQL, whether you use it from Java, Python, Ruby, Node.js, or whatever. Drivers don't need to support as much as full Cassandra client libraries, so there is less need for maintenance and less dependence on client authors.

The Python CQL driver is on GitHub: datastax/python-driver. (Previous releases were on Google Code.)

For information on CQL, see Datastax's quite through docs for CQL 2, a post on how to make effective data models with CQL 3, and a post on what's new in CQL 3 overall.

There's also a full reference on CQL 3 which is pending approval into the official Cassandra repo; while it's waiting, you should be able to read it here in pcmanus' github.

All that said, though, if you'd rather not use CQL, Pycassa really is better maintained and ought to have good support for quite some time.

Breban answered 3/5, 2012 at 18:56 Comment(3)
Thanks for your answer, and special thanks for the links, they 're really good. Regarding pycassa: is it using CQL? Can I combine using pycassa and use CQL thru it for some special things?Latialatices
Think I found one answer: pycassa is using thrift, so no CQL here. I will go with CQL3 and your suggestion. Thanks.Latialatices
Right, pycassa uses thrift and is not ideal for CQL. However, it ought to be possible to execute CQL statements through pycassa using the execute_cql thrift call, if you really want to combine the two. You just wouldn't get any of the driver conveniences like an idiomatic db interface, simple deserialization and schema interpretation, etc.Breban
C
4

I would go with pycassa. We have been using it for quite a while and work pretty well.

Clarkson answered 4/5, 2012 at 8:48 Comment(2)
If you are starting a new project, it is highly recommended that you use the newer DataStax python driver instead of pycassa.Drudgery
For the record, pycassa doesn't support python 3.Vouchsafe
S
1

For the moment I am also using pycassa, and I pass the results to colander, which hooks some model(s) to the results of the query obtained with pycassa.

This is similar to what pycassa.columnfamilymap offers, but I can directy "simulate" an ORM like and generate/validate forms using the same "model(s)" via deform

However, if some "real ORM" comes up, written over CQL, I would switch to it, but for the moment this is the solution I found. If someone has a better one, I would consider it with great interest.

Schoenfeld answered 14/10, 2012 at 19:43 Comment(0)
W
0

If you're on an older version of Cassandra (specifically talking about 1.0.8 here) please don't use CQLSH. I'm using CQLSH and am getting incorrect data that's inconsistent with what I get from cassandra-cli. I tried using nodetool's repair, clean, etc., but get Error connection to remote JMX agent! errors. I'm also absolutely certain that the cassandra-cli data is correct.

What a bunch of crap...

EDIT:

Turns out that I was using different versions of Cassandra on the client and server side. I thought that it would be backwards-compatible, but apparently it's not.

Washboard answered 28/10, 2013 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.