I am trying to add a primary key using pycassa. I can do that using CQL3 but I cannot find any document that explains how to do this with Pycassa in the web. I googled too much, didnt find anything.
Does anyone know how can I specify which will be my primary key of my column family using Pycassa?
Also, I have another question. Is it possible to have a large primary key? For example PRIMARY KEY(id, name, last_name, age).
Thank you
Yes, you can have a large primary key ("composite key"). In your example,
idwould then be the partition key, andname,last_name,ageare clustering keys. All fields combined make the primary key.For a very good explanation of the different types (and naming) of keys, check out this SO answer.
This post gives an example of how to create a composite key:
For your data then, I would guess:
I have not used pycassa myself, but the pycassa documentation has this example:
So I'll venture a guess for your case (adding a couple of columns for the sake of completeness):