Map pattern

Whenever there is a need to provide a mapping of keys to values as part of a record, use the Cassandra data type Map in the column family. The "as part of a record" part of preceding sentence is very important. This must not be misunderstood as any general lookup service of records such as the master tables in the RDBMS world.

Motivations/solutions

In the normalized RDBMS tables, whenever there is a need to provide a key to value mapping for an entity, the easiest and most straightforward approach is to create a small lookup table with the key as the primary key of the lookup table and the value as the non-primary key. Just like all the other patterns discussed in this chapter, the joins of the tables are required to get all the pieces ...

Get Cassandra Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.