pythoncassandracqlengine

cqlengine: way to create nested map


In what ways we can create a nested map in cqlengine models, For e.g

class Test(Model):
     id = columns.UUID(primary_key=True, default=uuid.uuid4)
     address = columns.Map(key_type, value_type)

I want "value_type"(in address column) to be a dictionary again, how should we achieve this using cqlengine data modelling.


Solution

  • This isn't possible in the current Cassandra release. Container columns can't contain other containers. In C* 2.1 (unreleased), this should be achievable using user defined types, although cqlengine support will lag behind the C* release a little.

    http://www.datastax.com/dev/blog/cql-in-2-1