Five Stars

Creating and inserting a Map into Cassandra



I have the following issue when importing MsSQLServer data into Cassandra:

I need to import several MsSQLServer tables with varying number of fields into a single Cassandra Table with a 'Map' data type field. I'm having trouble combining, for instance, 5 fields of a schema into one object and inserting into the map in Cassandra. 


My current approach was trying to use literal statements with bound variables (e.g "Insert into xx (id,map) values ('whatever', {'nonsense': ?});"), but that does not work, and the following error message pops up

   - "Invalid map literal for sensors: bind variables are not supported inside collection literals"


Is the correct approach create a Java Object for each of the different MsSQLServer tables and then inserting it as follows: 

   - "Insert into xx (id, map) values (?,?);"


And if so, how would I be able to do this?


I would really appreciate some help.

Five Stars

Re: Creating and inserting a Map into Cassandra