cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vitaly Kushner <vit...@astrails.com>
Subject data model question
Date Mon, 30 Nov 2009 13:16:39 GMT
Hi. I need to store a bunch of 'models' for an application in cassandra,
and I'm not sure if my mental model is right (seems to be the norm at first :)
Is the following a good idea?:
- always use a "super" column family for models
- store *simple* attributes (like name, email etc) for the model
inside an 'attributes' super column with attribute names as columns
inside it.
- store 'associations' for this model inside separate super columns
(e.g. list of accounts for the user etc)
- store 'array' (e.g. spoken languages, interests etc) and 'hash'
attributes also inside separate super columns

So that the data looks something like:

Accounts: {
  "1": {
    "attributes": {
      "name": "Some account name",
      "plan": "free",
      "foo": "bar"
    },
    "languages": {
      "English" => "",
      "Russian" => "",
    }
    "user_ids": {
      "1": "",
      "2": ""
    }
  },
"2": {...},
...
"5": {...}
}

Users: {
  "1": {
    "attributes": {
      "name" => "Vitaly",
      "email" => "vitaly@astrails.com",
      "password_hash": "928349238749283479238",
      "last_login" => "...."
    }
    "account_ids": {
      "1" => "",
      "5" => ""
    }
  }
}

Mime
View raw message