cassandradatastaxcassandra-3.0cqlshphantom-dsl

How to store List(list(value)) in cassandra table?


How to store List(List(1,2,3,4),List(1,2,3,0)) values in one column in Cassandra table?

I have createed table with columns

list


Solution

  • That should work automatically actually, except nested collection types will cause freezing.

    Have you simply tried:

    case class Record(id: UUID, nested: List[List[Int]])
    
    abstract class MyTable extends Table[MyTable, Record] {
      object id extends Col[UUID] with PartitionKey
      object nested extends Col[List[List[Int]]
    }
    

    You will get a more funky Cassandra type when you do that, something of the kind nested list<frozen<list<int>>>, which means you cannot update the content of the nested lists, you can only update the entire column, but you should be able to do it.