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" => "[email protected]",
      "password_hash": "928349238749283479238",
      "last_login" => "...."
    }
    "account_ids": {
      "1" => "",
      "5" => ""
    }
  }
}

Reply via email to