I have queried Cassandra using spark in Scala. Below is the result:
Is there any way to write this result back to Cassandra tables ?
I have queried Cassandra using spark in Scala. Below is the result:
Is there any way to write this result back to Cassandra tables ?
df.write
.format("org.apache.spark.sql.cassandra")
.options(Map( "table" -> "t_payu_df", "keyspace" -> "ks_payu"))
.save()
This will work.
You can also specify SaveMode (overwrite,append,ErrorIfExists).
Example with SaveMode:
df.write
.format("org.apache.spark.sql.cassandra")
.mode(SaveMode.Overwrite)
.options(Map( "table" -> "t_payu_df", "keyspace" -> "ks_payu"))
.save()
For more details visit Dataframe