0

It seems that Cassabdra behaves differently when inserting data to (existing row in) a table while not/using JSON.

Here is an example:

  1. "INSERT INTO " + tableName + "(" + fields + ") VALUES (" + values + ")"
  2. "INSERT INTO " + tableName + " JSON '" + json + "'"

In example #1, the insert acts like an upsert- updating only the mentioned fields and keeping the rest of the fields as they were before the insert.

In example #2, the insert acts almost like a classic insert - overwriting the old row with the new one.

What's the best way using JSON query (like example #2) which will act as the query in example #1?

Thanks ahead,

Eyal

Eyal Weisz
  • 95
  • 1
  • 10
  • Not sure if there's a way to do what you want using a JSON insert. The documentation states "Columns which are omitted from the JSON value map are treated as a null insert (which results in an existing value being deleted, if one is present)". See http://www.datastax.com/dev/blog/whats-new-in-cassandra-2-2-json-support – Chris Fei Oct 30 '15 at 18:41
  • Thanks Chris Fei, that's exactly what happened in my experiment. Hope'd I missed something. – Eyal Weisz Nov 01 '15 at 08:11

0 Answers0