How to insert data into Cassandra table using Spark DataFrame?

0 votes

Hi Guys,

I have Dataframe in Spark. I want to insert data from Spark DataFrame to the Cassandra table. How can I do that?

Sep 21 in Apache Spark by akhtar
• 27,980 points
88 views

1 answer to this question.

0 votes

Hi@akhtar,

You can write the spark dataframe in your Cassandra. For that, you need to specify the format as shown below.

val personDF = sqlContext.applySchema(rowRDD, schema)
personDF.write.format("org.apache.spark.sql.cassandra").options(Map( "table" -> "words_copy", "keyspace" -> "test")).save()
answered Sep 21 by MD
• 64,820 points

Related Questions In Apache Spark

0 votes
3 answers

How to transpose Spark DataFrame?

Please check the below mentioned links for ...READ MORE

answered Dec 31, 2018 in Apache Spark by anonymous
13,099 views
0 votes
1 answer

How to convert rdd object to dataframe in spark

SqlContext has a number of createDataFrame methods ...READ MORE

answered May 30, 2018 in Apache Spark by nitinrawat895
• 10,950 points
2,580 views
0 votes
1 answer
0 votes
7 answers
+1 vote
2 answers
0 votes
1 answer

How to convert Spark data into CSV?

You can use this: df.write .option("header", "true") ...READ MORE

answered Nov 21, 2018 in Big Data Hadoop by Omkar
• 69,030 points
1,482 views
0 votes
1 answer

How to find the number of null contain in dataframe?

Hey there! You can use the select method of the ...READ MORE

answered May 3, 2019 in Apache Spark by Omkar
• 69,030 points
814 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,950 points
6,062 views
+1 vote
1 answer

How to convert pyspark Dataframe to pandas Dataframe?

Hi@akhtar, To convert pyspark dataframe into pandas dataframe, ...READ MORE

answered May 7 in Apache Spark by MD
• 64,820 points
3,010 views
+1 vote
1 answer

How to read .mp4 (video file) stored at HDFS using pyspark?

Hi@Amey, You can enable WebHDFS to do this ...READ MORE

answered May 29 in Apache Spark by MD
• 64,820 points
222 views