Arun A K
Arun A K

Reputation: 2225

Column Family, Super Column Family, Super Column in Cassandra

I Would like to have a clarification. I have the following hierarchy -

Person: {
    personal_details:{
        name:aa
        age:aaa
        ddress:aa
    }
    official_details:{
        employeeid:aa
        cubicle_number:aa
    }
}

I would like to represent Person in a Cassandra database. I would like each person to be queried by his SSN (not included in the above hierarchy).

If it were a HBase schema, I would call Person as my table. I would have SSN as my row key and personal_details as well as official_details as column families and name,age,address,employeeid & cubicle_number as columns. What is the cassandra nomenclature for these hierarchies and what could be the possible creation queries for this hierarchy in cassandra?

Upvotes: 3

Views: 2273

Answers (1)

jorgebg
jorgebg

Reputation: 6600

Check the DataStax documentation on Anatomy of a table.

In this case, creating the data structure you are looking for in Cassandra, the CQL would be very similar to SQL.

CREATE TABLE people 
(
  ssn text PRIMARY KEY,
  name text,
  age int,
  address text,
  employeeid int,
  cubicle_number int
);

About super columns on Cassandra, it is now not recommended.

Upvotes: 3

Related Questions