Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Apache Cassandra - Second Edition

You're reading from  Learning Apache Cassandra - Second Edition

Product type Book
Published in Apr 2017
Publisher
ISBN-13 9781787127296
Pages 360 pages
Edition 2nd Edition
Languages
Concepts

Table of Contents (14) Chapters

Getting Up and Running with Cassandra The First Table Organizing Related Data Beyond Key-Value Lookup Establishing Relationships Denormalizing Data for Maximum Performance Expanding Your Data Model Collections, Tuples, and User-Defined Types Aggregating Time-Series Data How Cassandra Distributes Data Cassandra Multi-Node Cluster Application Development Using the Java Driver Peeking under the Hood Authentication and Authorization

Coupling parents and children using static columns


The parent-child relationships we've encoded in our schema thus far are implicit in the structure of the primary keys but not explicit from Cassandra's standpoint. While we know that the user_status_updates.username column corresponds to the parent primary key users.username, Cassandra itself has no concept of the relationship between the two.

In a relational database, we might make the relationship explicit in the schema using foreign key constraints, but Cassandra doesn't offer anything like this. In fact, if we want to use two different tables for users and user_status_updates, there isn't anything we can do to explicitly encode their relationship in the database schema. However, there is a way to combine user profiles and status updates into a single table while still maintaining the one-to-many relationship between them. To achieve this merger, we'll use a feature of Cassandra tables that we haven't seen before—static columns.

Defining...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}