Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 7 Materials and Homework.

Registrations still open!


question

tharunmukka1_174333 avatar image
tharunmukka1_174333 asked ·

How do I retrieve data from the videos_by_tag table in exercise 3 of the DS201 course?

DS 201: Exercise 3 – Partitions, 12th step in exercise

write a query to retrieve the video having a title of Cassandra Intro. Here the title column is not a part of partition key nor primary key. how to retrieve data in this case?

academyds201
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

bettina.swynnerton avatar image
bettina.swynnerton answered ·

Hi @tharunmukka1_174333,

yes, you are correct, you cannot retrieve a video by title from this table, as title is not the partition key, unless you allow filtering (which scans the full table and is not performant).

CREATE TABLE videos_by_tag (
    tag TEXT,
    video_id UUID,
    added_date TIMESTAMP,
    title TEXT,
    PRIMARY KEY ((tag), video_id)
);                                                 

The solution to this step calls this out (see the "Partitions - Solutions" pdf). It's an exercise to check your understanding, and you got it right.

Hope this helps!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks for the clarification. Where can I find the "partitions - solutions" pdf.

0 Likes 0 · ·

Hi @tharunmukka1_174333,

you can download a zip with the exercises and solutions from the course page, I copy the link for you here:

https://s3.amazonaws.com/datastaxtraining/documents/DS201-Exercises.zip


0 Likes 0 · ·