Cassandra constraints

Viewed 120

We have a usecase of allowing only certain values in a cassandra column.

Example:

 CREATED TABLE Cars(
    company text,
    model text,
    year int,
    vin text
 )

where a company may be from a spcific list of car makers e.g. GM, Toyota, Honda etc.

Does cassandra support defining constraints for above use-case ? OR this needs to be handled at program level ?

1 Answers

There is no in built support for enums in cassandra.

But Datastax drivers does have option to define custom codec, which might help.

Enum Java Driver

Related