How do I insert strings into cassandra if they don't exist using sparkcassandra driver?
3 answers
Srinu, it all boils down to read-before-write whether you are using Spark or not.
But there is a suggestion IF NOT EXISTS
:
If the column exists, it is updated. The string is created if none exists. Use IF NOT EXISTS to perform an insert only if the row does not already exist. Using IF NOT EXISTS leads to performance penalties associated with using Paxos internally. For information on Paxos, see the Cassandra 2.1 documentation or the Cassandra 2.0 documentation.
http://docs.datastax.com/en/cql/3.1/cql/cql_reference/insert_r.html
0
source to share