incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Ikeda" <Anthony.Ik...@cardlink.com.au>
Subject Understanding SuperColumns
Date Mon, 28 Jun 2010 02:36:05 GMT
I seem to be scratching my head about how to model Super Columns
properly and how they relate to a 1 to many kind of relationship.

 

For example:

 

UserAccounts = {

                "PB12345": {

firstname: "Paul",

surname: "Brown",

address: {street: "Main St", suburb: "Springfield", state: "NY"}

}

}

 

Here I'm using address as a super column based on some of the examples
I've come across. What if Paul has multiple addresses or if an address
belonged to more than one person? Is the following still valid?

 

UserAccounts = {

                "PB12345" : {

firstname: "Paul",

surname: "Brown"

                },

                "SB12345": {

                                firstname: "Sue",

                                surname: "Brown"

                }

}

 

Addresses = {

                "address1": {

street: "Main St",

suburb: "Springfield",

state: "NY",

owners: {

                 "PB12345": {createdDate: "20100626"},

                "SB12345": {createdDate: "20100522"}

}

 },

                "address2": {

street: "Berry St",

suburb: "New York", 

state: "NY",

owners: {

                "PB12345": {moveInDate: "20100421"}

}

},

"address3": {

street: "5th Avenue",

suburb: "Springfield", 

state: "NY"

}

}

 

AddressesByType = {

                "home": {

                                address1: { street: "Main St", suburb:
"Springfield", state: "NY", owner="PB12345"}

                },

                "work": {

address2: {street: "Berry St", suburb: "New York", state: "NY",
owner="PB12345"},

address3: {street: "5th Avenue", suburb: "Springfield", state: "NY"}

                }

}

 

AddressByCity = {

                "New York": {

                                "address2": {createdDate: "01/01/1937"}

                },

"Springfield": {

                "address1": {createdDate: "12/05/1940"},

                                "address3": {createdDate: "12/12/1880"}

}

}

 

I understand that:

1.       There is a lack of relationships in modelling with NoSQL
systems between entities

2.       Data is represented in a way that you need to query it (e.g. I
need a model that represents all addresses by type, all addresses by
city, etc)

 

But to what degree do I end up tearing the data apart?

 

Say my query is: Get all Work addresses in New York and the address
owner. Steps to get the data would be:

 

1.       Find out which addresses are classified as "Type=Work" and get
the primary key of the super column (returns
[AddressByType][work][address2] and [AddressByType][work] [address3])

2.       Then get all the addresses located in "New York" (returns
[AddressByCity][New York][address2])

3.       Then get "owner" field from my records returned in Step 1
([AddressByType][work][address2][owner="PB12345"], address3 is
abandoned)

4.       Then retrieve the User details and Address details using
"address2" and "PB12345" using a kind of union...I think.

 

Am I over complicating this?

 

 

Anthony Ikeda

Java Analyst/Programmer

Cardlink Services Limited

Level 4, 3 Rider Boulevard

Rhodes NSW 2138

 

Web: www.cardlink.com.au | Tel: + 61 2 9646 9221 | Fax: + 61 2 9646 9283

 

 


**********************************************************************
This e-mail message and any attachments are intended only for the use of the addressee(s)
named above and may contain information that is privileged and confidential. If you are not
the intended recipient, any display, dissemination, distribution, or copying is strictly prohibited.
  If you believe you have received this e-mail message in error, please immediately notify
the sender by replying to this e-mail message or by telephone to (02) 9646 9222. Please delete
the email and any attachments and do not retain the email or any attachments in any form.
**********************************************************************
Mime
View raw message