best Cassandra library/wrapper for Python? [closed]

帅比萌擦擦* 提交于 2020-01-12 03:15:08

问题


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.


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/10430417/best-cassandra-library-wrapper-for-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!