cassandra

Spark + Kafka app, getting "CassandraCatalogException: Attempting to write to C* Table but missing primary key columns: [col1,col2,col3]"

Spark + Kafka app, getting "CassandraCatalogException: Attempting to write to C* Table but missing primary key columns: [col1,col2,col3]" Question: Run env kafka —-ReadStream—-> local —-WriteStream—-> cassandra source code place on local and kafka, local, writeStream is different IP Table columns are: col1 | col2 | col3 | col4 | col5 | col6 | col7 df.printSchema …

Total answers: 1

Query cassandra table in Databricks using python cassandra driver

Query cassandra table in Databricks using python cassandra driver Question: I’m trying to optimize a way to query a cassadnra table when working in databricks. After reading this article https://medium.com/@yoke_techworks/cassandra-and-pyspark-5d7830512f19, the author suggest to query the cassandra table one row at the time and union each results. My attempt, using the python cassandra driver, is …

Total answers: 1

Building cassandra-website with docker yields a python3 permissions error

Building cassandra-website with docker yields a python3 permissions error Question: I am trying to build https://github.com/apache/cassandra-website Python3 is installed, I started the docker daemon, git pull and then run ./run.sh website preview but it yields the following permissions issue even though I am running as root. [root@localhost cassandra-website]# ./run.sh website preview Server Docker Engine version: …

Total answers: 1

CQLSH ImportError: cannot import name ensure_str

CQLSH ImportError: cannot import name ensure_str Question: I have installed Cassandra database on my CentOs system. after that, I tried to install the Cqlsh package using this command sudo yum install cqlsh and it has been installed successfully. but when I tried to run cqlsh from the terminal, the following error appears: ImportError: cannot import …

Total answers: 5

How to insert Pandas DataFrame into Cassandra?

How to insert Pandas DataFrame into Cassandra? Question: I have a dataframe as below: df date time open high low last 01-01-2017 11:00:00 37 45 36 42 01-01-2017 11:23:00 36 43 33 38 01-01-2017 12:00:00 45 55 35 43 …. I want to write it into cassandra. It’s kind of bulk upload after processing on …

Total answers: 3

Unit Tests for Python: Mock Patch

Unit Tests for Python: Mock Patch Question: I am trying to write Unit Tests for Cassandra but am not able to get it work. Here is the code: CassandraLoggingModel.py: import uuid from cassandra.cqlengine import columns from datetime import datetime from cassandra.cqlengine.models import Model class CassandraRunLog(Model): pipeline_id = columns.Text(partition_key=True, max_length=180) task_id = columns.Text(partition_key=True, max_length=180) execution_date = …

Total answers: 1

Spark with Cassandra python setup

Spark with Cassandra python setup Question: I am trying to use spark to do some simple computations on Cassandra tables, but I am quite lost. I am trying to follow: https://github.com/datastax/spark-cassandra-connector/blob/master/doc/15_python.md So I’m running the PySpark shell: with ./bin/pyspark –packages com.datastax.spark:spark-cassandra-connector_2.11:2.0.0-M3 But I am not sure how to set things up from here. How do …

Total answers: 3

pyspark datastax cassandra connector keeps connecting to localhost

pyspark datastax cassandra connector keeps connecting to localhost Question: I am trying to connect pyspark to cassandra using datastax driver conf = SparkConf() .setAppName(‘Test’) .setMaster(‘local[4]’) .set(“spark.cassandra.connection.host”, “192.168.0.150”) sc = SparkContext(conf=conf) sqlContext = SQLContext(sc) df = sqlContext.read.format(“org.apache.spark.sql.cassandra”). options(table=”test”, keyspace=”test_keyspace”).load() For some reason it keeps connecting to 127.0.0.1:9042 instead of 192.168.0.150 Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried …

Total answers: 1

Django / Cassandra: can not createsuperuser

Django / Cassandra: can not createsuperuser Question: I am running Debian server with Django and Cassandra. I am not able to create the admin user via command: python manage.py createsuperuser Running the command causes an error: cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message=”line 1:260 no viable alternative at input ‘.’ (…auth_user.date_joined …

Total answers: 2