Keys

Tom Haughey thaughey at gmail.com
Wed Oct 10 01:30:36 EDT 2012


I just attended the Webinar on Intro To Riak. It did not say much about
schema design, just the one page. That is what I focus on. So let me ask a
question.

Say we have a bucket called Customer with Customer No : “123”. This
customer has attributes (key : value pairs) of: name : “Joey Brown”, date
of birth : “1/1/1980”, postal code : “12345”, customer type : “retail” date
became customer : “1/1/2005” purchase frequency : “5”

The JSON could be:

{ "name": “Gunther Boss”, "date of birth" : “1/1/1980”, "postal code" :
“12345”, "customer type" : “retail” "date became customer" : “1/1/2005”,
"purchase frequency" : “5”}

How does Riak know that these attributes all belong to Customer 123? That
Customer No is the ID? How do we specify the id for the whole row?

Cassandra uses the following:

RowId + Column Family + Column Qualifier + Timestamp + Value (or Payload).
(RowId + Column Family + Column Qualifier + Timestamp provide uniqueness).
The key is Column family + Column Qualifier

I believe I would assign Customer ID as the key to the bucket (Customer),
and the rest of the data would be stored in a string or blob. The
application would be responsible to decompose the string into the
appropriate fields. In my example above, there is one row containing key =
123, and the above document as the value { "name": “Gunther Boss”, "date of
birth" : “1/1/1980”, "postal code" : “12345”, "customer type" : “retail”
"date became customer" : “1/1/2005”, "purchase frequency" : “5”}. How do I
actually specify the key? In the JSON example, is there a reserved word or
expression to indicate what the key is? Or how do you actually specify the
key in RIAK?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20121010/cea870b2/attachment.html>


More information about the riak-users mailing list