Search code examples
databasecassandranosqlsql-updatecql

Update content of BLOB column data in Cassandra


I have a table in Cassandra, in which one column is a BLOB. I wish to update only some values in that blob. Is that possible ? Example : String form of BLOB is let's say: {"name":"ABC","rollNum": "1234"}

I want to make it as : {"name":"ABC","rollNum": "1333"} with an CQL update query.

Originally this column gets update from my JAVA code where I send byte[] to be inserted in this BLOB column. Now, I want to update just some fields without doing any type of select on this row.


Solution

  • You can't do this in general.

    Cassandra as any other database does not know how to interpret your blob. You will

    • need to read, parse, update and save your blob again
    • use a map instead
    • use single fields - which will give the most performance

    Apart from that, updates like you want to do can be archived in document databases like MongoDB.