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
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.
Related
Am trying to connect to elasticsearch using below in Jupyter notebook
engine = create_engine("elasticsearch+https://user:pwd#host:9200/")
however it gives the error:
Can't load plugin: sqlalchemy.dialects:elasticsearch.https
Can anyone please help?
TLDR; Simply install elasticsearch-dbapi:
pip install elasticsearch-dbapi
Details:
SQLAlchemy uses "dialects" to support reading and writing to different DBMS's.
SQLAlchemy natively supports MS SQL Server, Oracle, MySQL, Postgres and SQLite as well as others. Here is the full list: https://docs.sqlalchemy.org/en/14/dialects/
Elastic is not in that list. Hence, you need to install a library that delivers the dialect for reading/writing from/to Elastic.
Can someone guide me how to connect PBI Desktop to APACHE SPARK installed on a local windows machine? What should be the server details I should pass?
I have read thrift connections are very slow so would want to avoid them unless they are the only choice.
Edit -
Based on the suggestion, I tried to set up thrift connection following the below link - medium.com/#waqasrafiq327/… . Mine is a windows installation. Given paths seems to be for linux? I cant see a hive-site.xml file under /spark/conf folder. I also dont see a /apachehive/conf folder in my spark installtion. My spark installation is the latest version of spark release available. Please guide.
You have to use the thrift server as it is required if you want to connect via ODBC or JDBC. This is the only way to connect from Power BI to Apache Spark.
Are there any other ways to connect to AWS Redshift through Python 3.x on Windows 7 - 64 bit platform, apart from using psycopg2?
Is psycopg2, the only library which we can use to connect to Redshift?
You can find all the available drivers on the postgres wiki: https://wiki.postgresql.org/wiki/Python
There is one other driver supported on Windows, but in general psycopg2 is your best bet.
I have tried connecting to a remote Cassandra from Windows 10 using the latest Simba-Datastax ODBC Driver (trial version). I was successful with Cassandra 2.1 (I connected to a Cassandra docker actually) but failed with Cassandra 3.0.15 and 3.11. I have installed the driver and I am able to see it in the Windows Data sources tool (64 bits), under the System DSN tab.
When I specify the host, port and keyspace of my Cassandra 3.0 docker (exactly the same values that work allright for me with the Cassandra 2.1 docker) and press the "Test..." button to launch the connectivity test, I am getting a strange error that "not even procol version 1 is available".
According to this web site, Simba says the driver is compatible with Cassandra 3.X. Could you think of any reason why this fails but 2.1 is successful? :-(
PS: I see other people complaining here but with a different error message (No hosts available for the control connection)
I fixed it! I think I was using a wrong version of the driver - I was using Datastax driver which apparently does not work for Cassandra 3.X. I have now downloaded the latest version of the ODBC driver from the Simba website (30-day trial version) and it is working :-)
The confusion came from the fact that I thought the Datastax driver and the Simba driver were the same as I read somewhere that "Simba and Datastax have partnered to develop a driver...".
Thank you very much Aaron anyway.
First I had DataStax 3.7 installed and everything was fine but later I have downgraded to 2.2 and now I have reinstalled datastax 3.7 but i can't see it in services. I can open my datastax and connect to external clusters but I can't start my cassandra server and so Can't connect to local host.
How to solve this issue?
Thanks!