Questions tagged [datastax-python-driver]

DataStax Python Driver for Apache Cassandra

A modern, feature-rich and highly-tunable Python client library for Apache Cassandra (2.1+) using exclusively Cassandra's binary protocol and Cassandra Query Language v3.

The driver supports Python 2.7, 3.3, 3.4, 3.5, and 3.6.

If you require compatibility with DataStax Enterprise, use the DataStax Enterprise Python Driver.

53 questions
4
votes
1 answer

Cassandra Astra securely deploying to heroku

I am developing an app using python and Cassandra(Astra provider) and trying to deploy it on Heroku. The problem is connecting to the database requires the credential zip file to be present locally-…
3
votes
1 answer

Execute CQL queries from file using the datastax Python Cassandra driver

What I'm trying to do is load a CQL file to re-initialize (drop and create) all the tables in a keyspace. I've search through the documentation at https://datastax.github.io/python-driver/ but didn't find any immediate way of accomplishing…
dbrew5
  • 49
  • 3
2
votes
1 answer

Cassandra Python driver doesn't page large queries

It is said in the documentation that cassandra-driver does automatic paging when queries are large enough (with default_fetch_size being 5000 rows) and will return PagedResult. I have tested reading data from my local Cassandra which contains 9999…
2
votes
1 answer

Where can I pass the fetch_size on a PreparedStatement in the Cassandra Python driver?

I am trying to set the fetch_size on a PreparedStatement on Python for Cassandra driver 3.11. I can see this is possible on SimpleStatement but I am having problems to find how to use it for PreparedStatement. Since PreparedStatement is a result of…
Rafael
  • 2,521
  • 2
  • 33
  • 59
2
votes
2 answers

How to fix problem "Unable to complete the operation against any hosts" in Cassandra?

I have a pretty simple AWS Lambda function in which I connect to an Amazon Keyspaces for Cassandra database. This code in Python works, but from time to time I get the error. How do I fix this strange behavior? I have an assumption that you need to…
2
votes
1 answer

Cassandra Python driver protocol version and connection limits don't match

I am using Datastax python driver version:3.23 Cassandra version: DSE version 5.1.16 The output from cqlsh gives the following: [cqlsh 5.0.1 | Cassandra 3.11.3.5116 | DSE 5.1.16 | CQL spec 3.4.4 | Nativeprotocol v4] cluster =…
2
votes
1 answer

How to connect to Cassandra nodes with different ports?

I am trying to connect to cluster nodes having different ports (9042 and 9043), but cannot find ways to do it here: cluster = Cluster(['0.0.0.0','0.0.0.0'],port=9042) How do I do it?
2
votes
1 answer

Converting Date to datetime.datetime in Python? Or vice-versa?

BACKGROUND: I've been trying to compare two dates in a database to see when records were last modified and if they should be updated again. I'm relatively new to using both Python 2.7 and Cassandra 3.0, and I haven't found any other answers for how…
2
votes
1 answer

fastest way of inserting into cassandra using python cassandra driver

I am inserting and updating multiple entries into a table in Cassandra using python Cassandra driver. Currently my code looks like: cluster = Cluster() session = cluster.connect('db') for a in list: if bool: # calculate b …
1
vote
2 answers

Unable to connect to cluster with cqlsh, getting "TLSv1_3 is not a valid SSL protocol"

Unable to connect cassandra 4.0.7 using cqlsh when cassandra is enabled for TLSv1.3. Datastax driver version is driver-3.25.0 ./cqlsh --debug --ssl --cqlshrc /apache-cassandra/conf/cqlshrc 9042 Using CQL driver:
1
vote
1 answer

Query with IN operator results in NoHostAvailable, ConnectionBusy "host is overloaded"

We are trying to fetch the data from the Cassandra data base using IN query to filter the data for specific time duration as mentioned below: "SELECT * FROM "+ DATABASES['default']['NAME'] +".perform_stats WHERE device_id IN (" +…
1
vote
2 answers

Why is my Python app slow connecting to Cassandra compared to C#?

I have default configuration cassandra on default installation docker on windows 11. Table data contains 19 rows. The python driver is exceptionally slow and crashes in about 20% of cases. (Connection Timeout) I first expected this has something to…
SalkinD
  • 753
  • 9
  • 23
1
vote
3 answers

Inserting data with the Python driver returns "Syntax error in CQL query"

I've just got myself to Cassandra now I'm facing with data types issue Whenever I try to insert data as TEXT type, I got following error [Syntax error in CQL query] message="line 1:103 no viable alternative at input ',' (... filepath) VALUES (0,…
frankenstein
  • 125
  • 2
  • 11
1
vote
1 answer

Why does my query to AWS Keyspaces using the Cassandra Python driver return an empty list?

I am trying to use a prepared statement to query keyspaces via python's cassandra driver. This is the query and it's preparation... from cassandra.cluster import Cluster cluster = Cluster( **conn_details ) session =…
Sam Comber
  • 1,237
  • 1
  • 15
  • 35
1
vote
1 answer

Unable to create keyspace with the Python driver, getting Unauthorized error "Missing correct permission"

I am trying to create a keyspace on my `Astra' instance but I have gotten this error while trying the execute the CREATE statement: --------------------------------------------------------------------------- Unauthorized …
Ryan
  • 356
  • 1
  • 6
  • 26
1
2 3 4