Storing a list of values in Cassandra

后端 未结 3 1152
感情败类
感情败类 2021-01-13 08:46

Version Dependent

Some of the answers to this question deal with older versions of Cassandra. The correct answer for this kind of problem depends on the version of

3条回答
  •  庸人自扰
    2021-01-13 09:00

    In older versions of Cassandra, you had to serialize the list yourself and store it in a column, or perhaps use a super column.

    Since version 1.2 of Cassandra, CQL3 has collection types for columns, so you can give list as the type of a column in your schema. For example:

     CREATE TABLE Person (
        name text,
        skills list,
        PRIMARY KEY (name)
     );
    

    Or you could use set if you want to automatically eliminate duplicates.

提交回复
热议问题