Rocky Pulley
Rocky Pulley

Reputation: 23321

Cassandra super columns mixed?

I have a setup which looks sort of like this:

user: {
    data : {
        name
        email
    }
    address : {
        city
        state
    }
}

So data and address are super columns in the user column family...

What I really want is a mix of columns and super columns, such as:

user: {
    name
    email
    address : {
        city
        state
    }

Is this even possible with cassandra?

Upvotes: 0

Views: 145

Answers (1)

rs_atl
rs_atl

Reputation: 8985

First, you cannot mix standard and super columns in one CF. Each CF must be specified as standard or super. Second, you should avoid supercolumns as they are effectively deprecated. Instead, you can achieve this specific data model using a standard CF and storing the address fields using composite columns, like this:

user: {
    name : "John",
    email : "[email protected]",
    address:city : "Some City",
    address:state : "Some State"
}

This would allow you to store different address schemes, but be able to query them as a group of columns. I presume this is your objective.

Upvotes: 1

Related Questions