如果使用spark-cassandra驱动程序不存在行,如何将它们插入cassandra? [英] How to insert rows into cassandra if they don't exist using spark- cassandra driver?
本文介绍了如果使用spark-cassandra驱动程序不存在行,如何将它们插入cassandra?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从数据帧写入cassandra,如果要使用特定的行(例如,主键-尽管发生了更新,但我不想更改其他列),则想排除这些行,请使用spark-cassandra连接器.有办法吗?
I want to write to cassandra from a data frame and I want to exclude the rows if a particular row is already existing (i.e Primary key- though upserts happen I don't want to change the other columns) using spark-cassandra connector. Is there a way we can do that?
谢谢!!
推荐答案
您可以使用它的工作原理如下:
val writeConf = WriteConf(ifNotExists = true)
rdd.saveToCassandra(keyspaceName, tableName, writeConf = writeConf)
这篇关于如果使用spark-cassandra驱动程序不存在行,如何将它们插入cassandra?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文