Questions tagged [cassandra-python-driver]

Python client library for Apache Cassandra

access from python. Provides ORM for cassandra.

This drivers provides:

46 questions
10
votes
3 answers

Logging all queries with cassandra-python-driver

I'm trying to find a way to log all queries done on a Cassandra from a python code. Specifically logging as they're done executing using a BatchStatement Are there any hooks or callbacks I can use to log this?
dado_eyad
  • 601
  • 1
  • 8
  • 28
4
votes
2 answers

Python Cassandra floating precision loss

I'm sending data back and forth Python and Cassandra. I'm using both builtin float types in my python program and the data type for my Cassandra table. If I send a number 955.99 from python to Cassandra, in the database it shows 955.989999. When I…
4
votes
1 answer

Cassandra connection idling and timing out

I'm trying to load and delete data from Cassandra using the python driver. I have tried this both using cassandra running in a docker container and again locally after the docker version was giving me problems. Here's an example of what I'm…
ukejoe
  • 737
  • 2
  • 9
  • 20
3
votes
1 answer

Error accessing Scylladb cluster outside docker container

I'm running Scylladb locally in a docker container and I want to access the cluster outside the docker container. That's when I'm getting the following error: cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers') Datacenter:…
3
votes
1 answer

Optimize inserting data to Cassandra database through Python driver

I try to insert 150.000 generated data to the Cassandra using BATCH in Python driver. And it take approximately 30 seconds. What should I do to optimize it and insert data faster ? Here is my code: from cassandra.cluster import Cluster from faker…
GecKo
  • 143
  • 1
  • 11
2
votes
1 answer

cassandra-driver from DataStax: How to create Cassandra DB table from a Model?

I want to use ORM from DataStax Python Driver for Cassandra DB (create some class with data and automatically create a table from it without writing too much CQL = ) I've deployed a Cassandra server on localhost via docker and tried to do just like…
Felix
  • 3,351
  • 6
  • 40
  • 68
2
votes
1 answer

Cassandra Python executing multiple statement from string using python drive?

I want to execute multiple cql statements (2 or much more) using python driver. I try such simple code but it lead to error if query contains more then one statement. I do not want to split statements or format it (to single statements). I just want…
2
votes
1 answer

Cassandra NoHostAvailable mistake

I've just created two Cassandra clusters through Docker. The docker exec -it name nodetool status command tells that clusters created everything is ok: Then I'll try to INSERT data to table from the Python driver. Here is my code: from…
GecKo
  • 143
  • 1
  • 11
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

How to parametrize the table name using Cassandra's Python driver?

I have an instance method that is used to construct a Cassandra query, and I'm looking for a way to more safely parametrize the table name in a query without using string formatting. For example, def some_method(self, table_name): statement =…
Wes Doyle
  • 2,199
  • 3
  • 17
  • 32
2
votes
1 answer

Cassandra python driver - frozen with Object Mapper

I'm trying to declare and create (using sync_table) Cassandra table using a Object Mapper from python Cassandra driver (cassandra-driver package version 3.14), but I can't find a way to define a frozen value in a collection. Is there a way to…
2
votes
1 answer

Insert Pandas dataframe into Cassandra Table

From the documentation , there is a way to insert data into table: session.execute( """ INSERT INTO users (name, credits, user_id) VALUES (%s, %s, %s) """, ("John O'Reilly", 42, uuid.uuid1()) ) The column name have to be stated…
Mervyn Lee
  • 1,957
  • 4
  • 28
  • 54
1
vote
0 answers

Why cassandra python query result replaces column name's space with underscore?

I am using cassandra python driver. Version details : [cassandra-driver (3.25.0)] [cqlsh 6.8.0 | Cassandra 4.0.4 | CQL spec 3.4.5 | Native protocol v4] I am querying Cassandra database where I have created few columns which have empty space and…
sandejai
  • 931
  • 1
  • 15
  • 22
1
vote
0 answers

CassandraDB and Python: using the UnixSocketEndPoint?

I'm using cassandradb with the datastax python driver on a linux system. Typically when using other databases, I've found that that on unix-compatible systems there's usually a way to establish a connection to the database via a unix socket, instead…
Alex Pilafian
  • 121
  • 1
  • 5
1
vote
1 answer

Why do writes through Cassandra Python Driver add records with a delay?

I'm writing 2.5 million records into Cassandra using a python program. The program finishes quickly but on querying the data, the records are reflected after a long time. The number of records gradually increase and it seems like the database is…
1
2 3 4