Created
September 4, 2019 08:30
-
-
Save giasuddin90/6911702ba4d2a4551bce5665f01a8cfa to your computer and use it in GitHub Desktop.
Cassandra connection by using python driver, connect to Cassandra 2.1 with protocol version 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def connect21(keyspace="test_keyspace"): | |
| """ | |
| Cassandra connection by using python driver | |
| connect to cassandra 2.1 with protocol version 3 | |
| :param keyspace: | |
| :return: | |
| """ | |
| auth_provider = PlainTextAuthProvider(username="cassandra", password="cassandra") | |
| cluster = Cluster(["127.0.0.1"], auth_provider=auth_provider, protocol_version=4) | |
| session = cluster.connect(keyspace) | |
| session.row_factory = dict_factory | |
| return session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment