Reputation: 33
I am new to Cassandra and trying to connect it to python. I use pycharm as my IDE and am trying to connect to a cassandra database on a different server on Pycharm. I tried using datastax but I am reaching several roadblocks.
import cql
con= cql.connect(host="127.0.0.1",port=9160,keyspace="testKS")
This above is the code I have tried but it leads on several errors
Upvotes: 0
Views: 1552
Reputation: 57788
Not sure which version of Cassandra you're on, but the newer versions now disable Thrift on port 9160 by default, because the Thrift protocol has been deprecated.
Which driver are you trying to use? If you're following an example, you're probably trying to use a driver that's also been deprecated, due to its dependence on the Thrift model.
You will have much more success using the DataStax Python driver for Cassandra. It installs easily via pip (sudo pip install cassandra-driver
) and the getting started guide can get you on the correct path.
Upvotes: 2