Looking at your example, this is a list.
For a table based on Cassandra CQL documentation:
CREATE TABLE plays ( id text PRIMARY KEY, game text, players int, scores list<int> )
You must declare the model as follows:
class Plays(Model): id = columns.Text(primary_key=True) game = columns.Text() players = columns.Integer() scores = columns.List(columns.Integer())
You can create a new entry similar to this (omitting the connection code):
Plays.create(id = '123-afde', game = 'quake', players = 3, scores = [1, 2, 3])
Then, to update the list of ratings, follow these steps:
play = Plays.objects.filter(id = '123-afde').get() play.scores.append(20)
Now, if you request data with the CQL client, you should see the new values:
id | game | players | scores ----------+-------+---------+--------------- 123-afde | quake | 3 | [1, 2, 3, 20]
To get the values ββin python, you can simply use the array index:
print "Length is %(len)s and 3rd element is %(val)d" %\ { "len" : len(play.scores), "val": play.scores[2] }