Compound primary keys in column families
Now that we've established the relatively familiar-looking column family structure of users
—a table with a simple primary key—let's move on to a table with a compound primary key. To start, let's take a look at home_status_updates
, a fairly straightforward table. Recall that this table has a partition key timeline_username
; a clustering column status_update_id
; and two data columns, body
and status_update_username
column.
We'll use the LIST
command to take a look at the contents of the column family and, beforehand, we'll use the ASSUME
command to set the value output format to utf8
. This has a similar effect as the AS
modifier we used earlier, but it applies to all cells in a column family, rather than ...
Get Learning Apache Cassandra 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.