You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ben McCann <be...@benmccann.com> on 2012/03/26 09:04:57 UTC

How to store a list of values?

I have a profile column family and want to store a list of skills in each
profile.  In BigTable I could store a Protocol
Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with
a repeated field, but I'm not sure how this is typically accomplished
in Cassandra.  One option would be to store a serialized
Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do
this as I believe Cassandra doesn't
have knowledge of these formats, and so the data in the datastore would not
not human readable in CQL queries from the command line.  The other
solution I thought of would be to use a super column and put a random UUID
as the key for each skill:

skills: {
  '4b27c2b3ac48e8df': 'java',
  '84bf94ea7bc92018': 'c++',
  '9103b9a93ce9d18': 'cobol'
}

Is this a good way of handling lists in Cassandra?  I imagine there's some
idiom I'm not aware of.  I'm using the
Astyanax<https://github.com/Netflix/astyanax/wiki>client library,
which only supports composite columns instead of super
columns, and so the solution I proposed above would seem quite awkward in
that case.  Though I'm still having some trouble understanding composite
columns as they seem not to be completely documented yet.  Would this
solution work with composite columns?

Thanks,
Ben

Re: How to store a list of values?

Posted by Ben McCann <be...@benmccann.com>.
I'm leaning towards storing serialized JSON at the moment.  It's too bad
Cassandra doesn't have some better way of storing collections or
document-oriented data (e.g. a JsonType queryable with CQL).


On Wed, Mar 28, 2012 at 1:19 AM, R. Verlangen <ro...@us2.nl> wrote:

> If you use the CompositeColumn it does, but it looked to me in your
> example you just used the simple utf8-based solution. My apologies for the
> confusion.
>
>
> 2012/3/28 Ben McCann <be...@benmccann.com>
>
>> Hmm. I thought that Cassandra would encode the composite column without
>> the colon and that it was only there for illustration purposes, so the
>> suggestion to use ~ is confusing.  Are there some docs you can point me to?
>>  Also, after some reading, it seems to me that it is not even possible to
>> have a composite column together with a regular column in a column family
>> in this manner.
>>
>>
>> On Wed, Mar 28, 2012 at 12:34 AM, R. Verlangen <ro...@us2.nl> wrote:
>>
>>> Yes, that is one of the possible solutions to your problem.
>>>
>>> When you want to retrieve only the skills of a particular row just get
>>> the columns with as start value "skill:".
>>>
>>> A suggestion to your example might be to use a ~ in stead of : as
>>> separator. A tilde is used less often in standard sentences, so you could
>>> replace any of them in skills with some other character (e.g. a dash or
>>> whitespace).
>>>
>>> 2012/3/27 Ben McCann <be...@benmccann.com>
>>>
>>>> I was given one other suggestion (which may have been suggested earlier
>>>> in this thread, but is clearer to me with an example).  The suggestion was
>>>> to use composite columns and have the first part of the key name be "skill"
>>>> and the second part be the specific skill and then store a null value.  I
>>>> hope I understood this suggestion correctly.
>>>>
>>>> user: {
>>>>   'name': 'ben',
>>>>   'title': 'software engineer',
>>>>   'company': 'google',
>>>>   'location': 'orange county',
>>>>   'skill:java': '',
>>>>   'skill:html': '',
>>>>   'skill:javascript': ''
>>>> }
>>>>
>>>>
>>>> On Tue, Mar 27, 2012 at 12:04 AM, samal <sa...@gmail.com> wrote:
>>>>
>>>>> YEAH! agree, it only matter for time bucket data.
>>>>>
>>>>>
>>>>> On Tue, Mar 27, 2012 at 12:31 PM, R. Verlangen <ro...@us2.nl> wrote:
>>>>>
>>>>>> That's true, but it does not sound like a real problem to me.. Maybe
>>>>>> someone else can shed some light upon this.
>>>>>>
>>>>>>
>>>>>> 2012/3/27 samal <sa...@gmail.com>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:
>>>>>>>
>>>>>>>> " but any schema change will break it "
>>>>>>>>
>>>>>>>> How do you mean? You don't have to specify the columns in Cassandra
>>>>>>>> so it should work perfect. Except for the "skill~" is preserverd for your
>>>>>>>> list.
>>>>>>>>
>>>>>>>
>>>>>>>  In case skill~ is decided to change to skill:: , it need to be
>>>>>>> handle at app level. Or otherwise had t update in all row, read it first,
>>>>>>> modify it, insert new version and delete old version.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> With kind regards,
>>>>>>
>>>>>> Robin Verlangen
>>>>>> www.robinverlangen.nl
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> With kind regards,
>>>
>>> Robin Verlangen
>>> www.robinverlangen.nl
>>>
>>>
>>
>
>
> --
> With kind regards,
>
> Robin Verlangen
> www.robinverlangen.nl
>
>

Re: How to store a list of values?

Posted by "R. Verlangen" <ro...@us2.nl>.
If you use the CompositeColumn it does, but it looked to me in your example
you just used the simple utf8-based solution. My apologies for the
confusion.

2012/3/28 Ben McCann <be...@benmccann.com>

> Hmm. I thought that Cassandra would encode the composite column without
> the colon and that it was only there for illustration purposes, so the
> suggestion to use ~ is confusing.  Are there some docs you can point me to?
>  Also, after some reading, it seems to me that it is not even possible to
> have a composite column together with a regular column in a column family
> in this manner.
>
>
> On Wed, Mar 28, 2012 at 12:34 AM, R. Verlangen <ro...@us2.nl> wrote:
>
>> Yes, that is one of the possible solutions to your problem.
>>
>> When you want to retrieve only the skills of a particular row just get
>> the columns with as start value "skill:".
>>
>> A suggestion to your example might be to use a ~ in stead of : as
>> separator. A tilde is used less often in standard sentences, so you could
>> replace any of them in skills with some other character (e.g. a dash or
>> whitespace).
>>
>> 2012/3/27 Ben McCann <be...@benmccann.com>
>>
>>> I was given one other suggestion (which may have been suggested earlier
>>> in this thread, but is clearer to me with an example).  The suggestion was
>>> to use composite columns and have the first part of the key name be "skill"
>>> and the second part be the specific skill and then store a null value.  I
>>> hope I understood this suggestion correctly.
>>>
>>> user: {
>>>   'name': 'ben',
>>>   'title': 'software engineer',
>>>   'company': 'google',
>>>   'location': 'orange county',
>>>   'skill:java': '',
>>>   'skill:html': '',
>>>   'skill:javascript': ''
>>> }
>>>
>>>
>>> On Tue, Mar 27, 2012 at 12:04 AM, samal <sa...@gmail.com> wrote:
>>>
>>>> YEAH! agree, it only matter for time bucket data.
>>>>
>>>>
>>>> On Tue, Mar 27, 2012 at 12:31 PM, R. Verlangen <ro...@us2.nl> wrote:
>>>>
>>>>> That's true, but it does not sound like a real problem to me.. Maybe
>>>>> someone else can shed some light upon this.
>>>>>
>>>>>
>>>>> 2012/3/27 samal <sa...@gmail.com>
>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:
>>>>>>
>>>>>>> " but any schema change will break it "
>>>>>>>
>>>>>>> How do you mean? You don't have to specify the columns in Cassandra
>>>>>>> so it should work perfect. Except for the "skill~" is preserverd for your
>>>>>>> list.
>>>>>>>
>>>>>>
>>>>>>  In case skill~ is decided to change to skill:: , it need to be
>>>>>> handle at app level. Or otherwise had t update in all row, read it first,
>>>>>> modify it, insert new version and delete old version.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> With kind regards,
>>>>>
>>>>> Robin Verlangen
>>>>> www.robinverlangen.nl
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> With kind regards,
>>
>> Robin Verlangen
>> www.robinverlangen.nl
>>
>>
>


-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

Re: How to store a list of values?

Posted by Ben McCann <be...@benmccann.com>.
Hmm. I thought that Cassandra would encode the composite column without the
colon and that it was only there for illustration purposes, so the
suggestion to use ~ is confusing.  Are there some docs you can point me to?
 Also, after some reading, it seems to me that it is not even possible to
have a composite column together with a regular column in a column family
in this manner.


On Wed, Mar 28, 2012 at 12:34 AM, R. Verlangen <ro...@us2.nl> wrote:

> Yes, that is one of the possible solutions to your problem.
>
> When you want to retrieve only the skills of a particular row just get the
> columns with as start value "skill:".
>
> A suggestion to your example might be to use a ~ in stead of : as
> separator. A tilde is used less often in standard sentences, so you could
> replace any of them in skills with some other character (e.g. a dash or
> whitespace).
>
> 2012/3/27 Ben McCann <be...@benmccann.com>
>
>> I was given one other suggestion (which may have been suggested earlier
>> in this thread, but is clearer to me with an example).  The suggestion was
>> to use composite columns and have the first part of the key name be "skill"
>> and the second part be the specific skill and then store a null value.  I
>> hope I understood this suggestion correctly.
>>
>> user: {
>>   'name': 'ben',
>>   'title': 'software engineer',
>>   'company': 'google',
>>   'location': 'orange county',
>>   'skill:java': '',
>>   'skill:html': '',
>>   'skill:javascript': ''
>> }
>>
>>
>> On Tue, Mar 27, 2012 at 12:04 AM, samal <sa...@gmail.com> wrote:
>>
>>> YEAH! agree, it only matter for time bucket data.
>>>
>>>
>>> On Tue, Mar 27, 2012 at 12:31 PM, R. Verlangen <ro...@us2.nl> wrote:
>>>
>>>> That's true, but it does not sound like a real problem to me.. Maybe
>>>> someone else can shed some light upon this.
>>>>
>>>>
>>>> 2012/3/27 samal <sa...@gmail.com>
>>>>
>>>>>
>>>>>
>>>>> On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:
>>>>>
>>>>>> " but any schema change will break it "
>>>>>>
>>>>>> How do you mean? You don't have to specify the columns in Cassandra
>>>>>> so it should work perfect. Except for the "skill~" is preserverd for your
>>>>>> list.
>>>>>>
>>>>>
>>>>>  In case skill~ is decided to change to skill:: , it need to be handle
>>>>> at app level. Or otherwise had t update in all row, read it first, modify
>>>>> it, insert new version and delete old version.
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> With kind regards,
>>>>
>>>> Robin Verlangen
>>>> www.robinverlangen.nl
>>>>
>>>>
>>>
>>
>
>
> --
> With kind regards,
>
> Robin Verlangen
> www.robinverlangen.nl
>
>

Re: How to store a list of values?

Posted by "R. Verlangen" <ro...@us2.nl>.
Yes, that is one of the possible solutions to your problem.

When you want to retrieve only the skills of a particular row just get the
columns with as start value "skill:".

A suggestion to your example might be to use a ~ in stead of : as
separator. A tilde is used less often in standard sentences, so you could
replace any of them in skills with some other character (e.g. a dash or
whitespace).

2012/3/27 Ben McCann <be...@benmccann.com>

> I was given one other suggestion (which may have been suggested earlier in
> this thread, but is clearer to me with an example).  The suggestion was to
> use composite columns and have the first part of the key name be "skill"
> and the second part be the specific skill and then store a null value.  I
> hope I understood this suggestion correctly.
>
> user: {
>   'name': 'ben',
>   'title': 'software engineer',
>   'company': 'google',
>   'location': 'orange county',
>   'skill:java': '',
>   'skill:html': '',
>   'skill:javascript': ''
> }
>
>
> On Tue, Mar 27, 2012 at 12:04 AM, samal <sa...@gmail.com> wrote:
>
>> YEAH! agree, it only matter for time bucket data.
>>
>>
>> On Tue, Mar 27, 2012 at 12:31 PM, R. Verlangen <ro...@us2.nl> wrote:
>>
>>> That's true, but it does not sound like a real problem to me.. Maybe
>>> someone else can shed some light upon this.
>>>
>>>
>>> 2012/3/27 samal <sa...@gmail.com>
>>>
>>>>
>>>>
>>>> On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:
>>>>
>>>>> " but any schema change will break it "
>>>>>
>>>>> How do you mean? You don't have to specify the columns in Cassandra so
>>>>> it should work perfect. Except for the "skill~" is preserverd for your list.
>>>>>
>>>>
>>>>  In case skill~ is decided to change to skill:: , it need to be handle
>>>> at app level. Or otherwise had t update in all row, read it first, modify
>>>> it, insert new version and delete old version.
>>>>
>>>>
>>>
>>>
>>> --
>>> With kind regards,
>>>
>>> Robin Verlangen
>>> www.robinverlangen.nl
>>>
>>>
>>
>


-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

Re: How to store a list of values?

Posted by Ben McCann <be...@benmccann.com>.
I was given one other suggestion (which may have been suggested earlier in
this thread, but is clearer to me with an example).  The suggestion was to
use composite columns and have the first part of the key name be "skill"
and the second part be the specific skill and then store a null value.  I
hope I understood this suggestion correctly.

user: {
  'name': 'ben',
  'title': 'software engineer',
  'company': 'google',
  'location': 'orange county',
  'skill:java': '',
  'skill:html': '',
  'skill:javascript': ''
}


On Tue, Mar 27, 2012 at 12:04 AM, samal <sa...@gmail.com> wrote:

> YEAH! agree, it only matter for time bucket data.
>
>
> On Tue, Mar 27, 2012 at 12:31 PM, R. Verlangen <ro...@us2.nl> wrote:
>
>> That's true, but it does not sound like a real problem to me.. Maybe
>> someone else can shed some light upon this.
>>
>>
>> 2012/3/27 samal <sa...@gmail.com>
>>
>>>
>>>
>>> On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:
>>>
>>>> " but any schema change will break it "
>>>>
>>>> How do you mean? You don't have to specify the columns in Cassandra so
>>>> it should work perfect. Except for the "skill~" is preserverd for your list.
>>>>
>>>
>>>  In case skill~ is decided to change to skill:: , it need to be handle
>>> at app level. Or otherwise had t update in all row, read it first, modify
>>> it, insert new version and delete old version.
>>>
>>>
>>
>>
>> --
>> With kind regards,
>>
>> Robin Verlangen
>> www.robinverlangen.nl
>>
>>
>

Re: How to store a list of values?

Posted by samal <sa...@gmail.com>.
YEAH! agree, it only matter for time bucket data.

On Tue, Mar 27, 2012 at 12:31 PM, R. Verlangen <ro...@us2.nl> wrote:

> That's true, but it does not sound like a real problem to me.. Maybe
> someone else can shed some light upon this.
>
>
> 2012/3/27 samal <sa...@gmail.com>
>
>>
>>
>> On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:
>>
>>> " but any schema change will break it "
>>>
>>> How do you mean? You don't have to specify the columns in Cassandra so
>>> it should work perfect. Except for the "skill~" is preserverd for your list.
>>>
>>
>>  In case skill~ is decided to change to skill:: , it need to be handle at
>> app level. Or otherwise had t update in all row, read it first, modify it,
>> insert new version and delete old version.
>>
>>
>
>
> --
> With kind regards,
>
> Robin Verlangen
> www.robinverlangen.nl
>
>

Re: How to store a list of values?

Posted by "R. Verlangen" <ro...@us2.nl>.
That's true, but it does not sound like a real problem to me.. Maybe
someone else can shed some light upon this.

2012/3/27 samal <sa...@gmail.com>

>
>
> On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:
>
>> " but any schema change will break it "
>>
>> How do you mean? You don't have to specify the columns in Cassandra so it
>> should work perfect. Except for the "skill~" is preserverd for your list.
>>
>
>  In case skill~ is decided to change to skill:: , it need to be handle at
> app level. Or otherwise had t update in all row, read it first, modify it,
> insert new version and delete old version.
>
>


-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

Re: How to store a list of values?

Posted by samal <sa...@gmail.com>.
On Tue, Mar 27, 2012 at 1:47 AM, R. Verlangen <ro...@us2.nl> wrote:

> " but any schema change will break it "
>
> How do you mean? You don't have to specify the columns in Cassandra so it
> should work perfect. Except for the "skill~" is preserverd for your list.
>

 In case skill~ is decided to change to skill:: , it need to be handle at
app level. Or otherwise had t update in all row, read it first, modify it,
insert new version and delete old version.

Re: How to store a list of values?

Posted by "R. Verlangen" <ro...@us2.nl>.
" but any schema change will break it "

How do you mean? You don't have to specify the columns in Cassandra so it
should work perfect. Except for the "skill~" is preserverd for your list.

2012/3/26 samal <sa...@gmail.com>

>
> Save the skills in a single column in json format.  Job done.
>>
> Good if  it have fixed set of skills, then any add or delete changes need
> handle in app. ->read column first->reformat JOSN->update column (2 thrift
> calls).
>
>  skill~Java: null,
>  skill~Cassandra: null
> This is also good option, but any schema change will break it.
>
>
> On Mar 26, 2012 7:04 PM, "Ben McCann" <be...@benmccann.com> wrote:
>>
>>> True.  But I don't need the skills to be searchable, so I'd rather embed
>>> them in the user than add another top-level CF.  I was thinking of doing
>>> something along the lines of adding a skills super column to the User table:
>>>
>>> skills: {
>>>   'java': null,
>>>   'c++': null,
>>>   'cobol': null
>>> }
>>>
>>> However, I'm still not sure yet how to accomplish this with Astyanax.
>>>  I've only figured out how to make composite columns with predefined column
>>> names with it and not dynamic column names like this.
>>>
>>>
>>>
>>> On Mon, Mar 26, 2012 at 9:08 AM, R. Verlangen <ro...@us2.nl> wrote:
>>>
>>>> In this case you only neem the columns for values. You don't need the
>>>> column-values to hold multiple columns (the super-column principle). So a
>>>> normal CF would work.
>>>>
>>>>
>>>> 2012/3/26 Ben McCann <be...@benmccann.com>
>>>>
>>>>> Thanks for the reply Samal.  I did not realize that you could store a
>>>>> column with null value.  Do you know if this solution would work with
>>>>> composite columns?  It seems super columns are being phased out in favor of
>>>>> composites, but I do not understand composites very well yet.  I'm trying
>>>>> to figure out if there's any way to accomplish what you've suggested using
>>>>> Astyanax <https://github.com/Netflix/astyanax>.
>>>>>
>>>>> Thanks for the help,
>>>>> Ben
>>>>>
>>>>>
>>>>> On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:
>>>>>
>>>>>> plus it is fully compatible with CQL.
>>>>>> SELECT * FROM UserSkill WHERE KEY='ben';
>>>>>>
>>>>>>
>>>>>> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>>>>>>
>>>>>>> I would take simple approach. create one other CF "UserSkill"  with
>>>>>>> row key same as profile_cf key,
>>>>>>> In user_skill cf will add skill as column name and value null.
>>>>>>> Columns can be added or removed.
>>>>>>>
>>>>>>> UserProfile={
>>>>>>>   '*ben*'={
>>>>>>>    blah :blah
>>>>>>>    blah :blah
>>>>>>>    blah :blah
>>>>>>>  }
>>>>>>> }
>>>>>>>
>>>>>>> UserSkill={
>>>>>>>   '*ben*'={
>>>>>>>     'java':''
>>>>>>>     'cassandra':''
>>>>>>>   .
>>>>>>>   .
>>>>>>>   .
>>>>>>>   'linux':''
>>>>>>>   'skill':'infinity'
>>>>>>>
>>>>>>>  }
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com>wrote:
>>>>>>>
>>>>>>>> I have a profile column family and want to store a list of skills
>>>>>>>> in each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>>>>>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>>>>>> have knowledge of these formats, and so the data in the datastore would not
>>>>>>>> not human readable in CQL queries from the command line.  The other
>>>>>>>> solution I thought of would be to use a super column and put a random UUID
>>>>>>>> as the key for each skill:
>>>>>>>>
>>>>>>>> skills: {
>>>>>>>>   '4b27c2b3ac48e8df': 'java',
>>>>>>>>   '84bf94ea7bc92018': 'c++',
>>>>>>>>   '9103b9a93ce9d18': 'cobol'
>>>>>>>> }
>>>>>>>>
>>>>>>>> Is this a good way of handling lists in Cassandra?  I imagine
>>>>>>>> there's some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>>>>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>>>>>> that case.  Though I'm still having some trouble understanding composite
>>>>>>>> columns as they seem not to be completely documented yet.  Would this
>>>>>>>> solution work with composite columns?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Ben
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> With kind regards,
>>>>
>>>> Robin Verlangen
>>>> www.robinverlangen.nl
>>>>
>>>>
>>>
>


-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

Re: How to store a list of values?

Posted by samal <sa...@gmail.com>.
> Save the skills in a single column in json format.  Job done.
>
Good if  it have fixed set of skills, then any add or delete changes need
handle in app. ->read column first->reformat JOSN->update column (2 thrift
calls).

 skill~Java: null,
 skill~Cassandra: null
This is also good option, but any schema change will break it.


On Mar 26, 2012 7:04 PM, "Ben McCann" <be...@benmccann.com> wrote:
>
>> True.  But I don't need the skills to be searchable, so I'd rather embed
>> them in the user than add another top-level CF.  I was thinking of doing
>> something along the lines of adding a skills super column to the User table:
>>
>> skills: {
>>   'java': null,
>>   'c++': null,
>>   'cobol': null
>> }
>>
>> However, I'm still not sure yet how to accomplish this with Astyanax.
>>  I've only figured out how to make composite columns with predefined column
>> names with it and not dynamic column names like this.
>>
>>
>>
>> On Mon, Mar 26, 2012 at 9:08 AM, R. Verlangen <ro...@us2.nl> wrote:
>>
>>> In this case you only neem the columns for values. You don't need the
>>> column-values to hold multiple columns (the super-column principle). So a
>>> normal CF would work.
>>>
>>>
>>> 2012/3/26 Ben McCann <be...@benmccann.com>
>>>
>>>> Thanks for the reply Samal.  I did not realize that you could store a
>>>> column with null value.  Do you know if this solution would work with
>>>> composite columns?  It seems super columns are being phased out in favor of
>>>> composites, but I do not understand composites very well yet.  I'm trying
>>>> to figure out if there's any way to accomplish what you've suggested using
>>>> Astyanax <https://github.com/Netflix/astyanax>.
>>>>
>>>> Thanks for the help,
>>>> Ben
>>>>
>>>>
>>>> On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:
>>>>
>>>>> plus it is fully compatible with CQL.
>>>>> SELECT * FROM UserSkill WHERE KEY='ben';
>>>>>
>>>>>
>>>>> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>>>>>
>>>>>> I would take simple approach. create one other CF "UserSkill"  with
>>>>>> row key same as profile_cf key,
>>>>>> In user_skill cf will add skill as column name and value null.
>>>>>> Columns can be added or removed.
>>>>>>
>>>>>> UserProfile={
>>>>>>   '*ben*'={
>>>>>>    blah :blah
>>>>>>    blah :blah
>>>>>>    blah :blah
>>>>>>  }
>>>>>> }
>>>>>>
>>>>>> UserSkill={
>>>>>>   '*ben*'={
>>>>>>     'java':''
>>>>>>     'cassandra':''
>>>>>>   .
>>>>>>   .
>>>>>>   .
>>>>>>   'linux':''
>>>>>>   'skill':'infinity'
>>>>>>
>>>>>>  }
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com>wrote:
>>>>>>
>>>>>>> I have a profile column family and want to store a list of skills in
>>>>>>> each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>>>>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>>>>> have knowledge of these formats, and so the data in the datastore would not
>>>>>>> not human readable in CQL queries from the command line.  The other
>>>>>>> solution I thought of would be to use a super column and put a random UUID
>>>>>>> as the key for each skill:
>>>>>>>
>>>>>>> skills: {
>>>>>>>   '4b27c2b3ac48e8df': 'java',
>>>>>>>   '84bf94ea7bc92018': 'c++',
>>>>>>>   '9103b9a93ce9d18': 'cobol'
>>>>>>> }
>>>>>>>
>>>>>>> Is this a good way of handling lists in Cassandra?  I imagine
>>>>>>> there's some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>>>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>>>>> that case.  Though I'm still having some trouble understanding composite
>>>>>>> columns as they seem not to be completely documented yet.  Would this
>>>>>>> solution work with composite columns?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Ben
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> With kind regards,
>>>
>>> Robin Verlangen
>>> www.robinverlangen.nl
>>>
>>>
>>

Re: How to store a list of values?

Posted by Sasha Dolgy <sd...@gmail.com>.
Save the skills in a single column in json format.  Job done.
On Mar 26, 2012 7:04 PM, "Ben McCann" <be...@benmccann.com> wrote:

> True.  But I don't need the skills to be searchable, so I'd rather embed
> them in the user than add another top-level CF.  I was thinking of doing
> something along the lines of adding a skills super column to the User table:
>
> skills: {
>   'java': null,
>   'c++': null,
>   'cobol': null
> }
>
> However, I'm still not sure yet how to accomplish this with Astyanax.
>  I've only figured out how to make composite columns with predefined column
> names with it and not dynamic column names like this.
>
>
>
> On Mon, Mar 26, 2012 at 9:08 AM, R. Verlangen <ro...@us2.nl> wrote:
>
>> In this case you only neem the columns for values. You don't need the
>> column-values to hold multiple columns (the super-column principle). So a
>> normal CF would work.
>>
>>
>> 2012/3/26 Ben McCann <be...@benmccann.com>
>>
>>> Thanks for the reply Samal.  I did not realize that you could store a
>>> column with null value.  Do you know if this solution would work with
>>> composite columns?  It seems super columns are being phased out in favor of
>>> composites, but I do not understand composites very well yet.  I'm trying
>>> to figure out if there's any way to accomplish what you've suggested using
>>> Astyanax <https://github.com/Netflix/astyanax>.
>>>
>>> Thanks for the help,
>>> Ben
>>>
>>>
>>> On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:
>>>
>>>> plus it is fully compatible with CQL.
>>>> SELECT * FROM UserSkill WHERE KEY='ben';
>>>>
>>>>
>>>> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>>>>
>>>>> I would take simple approach. create one other CF "UserSkill"  with
>>>>> row key same as profile_cf key,
>>>>> In user_skill cf will add skill as column name and value null. Columns
>>>>> can be added or removed.
>>>>>
>>>>> UserProfile={
>>>>>   '*ben*'={
>>>>>    blah :blah
>>>>>    blah :blah
>>>>>    blah :blah
>>>>>  }
>>>>> }
>>>>>
>>>>> UserSkill={
>>>>>   '*ben*'={
>>>>>     'java':''
>>>>>     'cassandra':''
>>>>>   .
>>>>>   .
>>>>>   .
>>>>>   'linux':''
>>>>>   'skill':'infinity'
>>>>>
>>>>>  }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com>wrote:
>>>>>
>>>>>> I have a profile column family and want to store a list of skills in
>>>>>> each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>>>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>>>> have knowledge of these formats, and so the data in the datastore would not
>>>>>> not human readable in CQL queries from the command line.  The other
>>>>>> solution I thought of would be to use a super column and put a random UUID
>>>>>> as the key for each skill:
>>>>>>
>>>>>> skills: {
>>>>>>   '4b27c2b3ac48e8df': 'java',
>>>>>>   '84bf94ea7bc92018': 'c++',
>>>>>>   '9103b9a93ce9d18': 'cobol'
>>>>>> }
>>>>>>
>>>>>> Is this a good way of handling lists in Cassandra?  I imagine there's
>>>>>> some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>>>> that case.  Though I'm still having some trouble understanding composite
>>>>>> columns as they seem not to be completely documented yet.  Would this
>>>>>> solution work with composite columns?
>>>>>>
>>>>>> Thanks,
>>>>>> Ben
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> With kind regards,
>>
>> Robin Verlangen
>> www.robinverlangen.nl
>>
>>
>

Re: How to store a list of values?

Posted by "R. Verlangen" <ro...@us2.nl>.
You can prefix the skills with something (you will "fake" the composite
columns), e.g.

john {
 name : John,
 phone : 1234567890
 skill~Java: null,
 skill~Cassandra: null
}

And then retreive the columns with start = "skill~"

2012/3/26 Ben McCann <be...@benmccann.com>

> True.  But I don't need the skills to be searchable, so I'd rather embed
> them in the user than add another top-level CF.  I was thinking of doing
> something along the lines of adding a skills super column to the User table:
>
> skills: {
>   'java': null,
>   'c++': null,
>   'cobol': null
> }
>
> However, I'm still not sure yet how to accomplish this with Astyanax.
>  I've only figured out how to make composite columns with predefined column
> names with it and not dynamic column names like this.
>
>
>
> On Mon, Mar 26, 2012 at 9:08 AM, R. Verlangen <ro...@us2.nl> wrote:
>
>> In this case you only neem the columns for values. You don't need the
>> column-values to hold multiple columns (the super-column principle). So a
>> normal CF would work.
>>
>>
>> 2012/3/26 Ben McCann <be...@benmccann.com>
>>
>>> Thanks for the reply Samal.  I did not realize that you could store a
>>> column with null value.  Do you know if this solution would work with
>>> composite columns?  It seems super columns are being phased out in favor of
>>> composites, but I do not understand composites very well yet.  I'm trying
>>> to figure out if there's any way to accomplish what you've suggested using
>>> Astyanax <https://github.com/Netflix/astyanax>.
>>>
>>> Thanks for the help,
>>> Ben
>>>
>>>
>>> On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:
>>>
>>>> plus it is fully compatible with CQL.
>>>> SELECT * FROM UserSkill WHERE KEY='ben';
>>>>
>>>>
>>>> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>>>>
>>>>> I would take simple approach. create one other CF "UserSkill"  with
>>>>> row key same as profile_cf key,
>>>>> In user_skill cf will add skill as column name and value null. Columns
>>>>> can be added or removed.
>>>>>
>>>>> UserProfile={
>>>>>   '*ben*'={
>>>>>    blah :blah
>>>>>    blah :blah
>>>>>    blah :blah
>>>>>  }
>>>>> }
>>>>>
>>>>> UserSkill={
>>>>>   '*ben*'={
>>>>>     'java':''
>>>>>     'cassandra':''
>>>>>   .
>>>>>   .
>>>>>   .
>>>>>   'linux':''
>>>>>   'skill':'infinity'
>>>>>
>>>>>  }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com>wrote:
>>>>>
>>>>>> I have a profile column family and want to store a list of skills in
>>>>>> each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>>>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>>>> have knowledge of these formats, and so the data in the datastore would not
>>>>>> not human readable in CQL queries from the command line.  The other
>>>>>> solution I thought of would be to use a super column and put a random UUID
>>>>>> as the key for each skill:
>>>>>>
>>>>>> skills: {
>>>>>>   '4b27c2b3ac48e8df': 'java',
>>>>>>   '84bf94ea7bc92018': 'c++',
>>>>>>   '9103b9a93ce9d18': 'cobol'
>>>>>> }
>>>>>>
>>>>>> Is this a good way of handling lists in Cassandra?  I imagine there's
>>>>>> some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>>>> that case.  Though I'm still having some trouble understanding composite
>>>>>> columns as they seem not to be completely documented yet.  Would this
>>>>>> solution work with composite columns?
>>>>>>
>>>>>> Thanks,
>>>>>> Ben
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> With kind regards,
>>
>> Robin Verlangen
>> www.robinverlangen.nl
>>
>>
>


-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

Re: How to store a list of values?

Posted by Ben McCann <be...@benmccann.com>.
True.  But I don't need the skills to be searchable, so I'd rather embed
them in the user than add another top-level CF.  I was thinking of doing
something along the lines of adding a skills super column to the User table:

skills: {
  'java': null,
  'c++': null,
  'cobol': null
}

However, I'm still not sure yet how to accomplish this with Astyanax.  I've
only figured out how to make composite columns with predefined column names
with it and not dynamic column names like this.



On Mon, Mar 26, 2012 at 9:08 AM, R. Verlangen <ro...@us2.nl> wrote:

> In this case you only neem the columns for values. You don't need the
> column-values to hold multiple columns (the super-column principle). So a
> normal CF would work.
>
>
> 2012/3/26 Ben McCann <be...@benmccann.com>
>
>> Thanks for the reply Samal.  I did not realize that you could store a
>> column with null value.  Do you know if this solution would work with
>> composite columns?  It seems super columns are being phased out in favor of
>> composites, but I do not understand composites very well yet.  I'm trying
>> to figure out if there's any way to accomplish what you've suggested using
>> Astyanax <https://github.com/Netflix/astyanax>.
>>
>> Thanks for the help,
>> Ben
>>
>>
>> On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:
>>
>>> plus it is fully compatible with CQL.
>>> SELECT * FROM UserSkill WHERE KEY='ben';
>>>
>>>
>>> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>>>
>>>> I would take simple approach. create one other CF "UserSkill"  with row
>>>> key same as profile_cf key,
>>>> In user_skill cf will add skill as column name and value null. Columns
>>>> can be added or removed.
>>>>
>>>> UserProfile={
>>>>   '*ben*'={
>>>>    blah :blah
>>>>    blah :blah
>>>>    blah :blah
>>>>  }
>>>> }
>>>>
>>>> UserSkill={
>>>>   '*ben*'={
>>>>     'java':''
>>>>     'cassandra':''
>>>>   .
>>>>   .
>>>>   .
>>>>   'linux':''
>>>>   'skill':'infinity'
>>>>
>>>>  }
>>>>
>>>> }
>>>>
>>>>
>>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com> wrote:
>>>>
>>>>> I have a profile column family and want to store a list of skills in
>>>>> each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>>> have knowledge of these formats, and so the data in the datastore would not
>>>>> not human readable in CQL queries from the command line.  The other
>>>>> solution I thought of would be to use a super column and put a random UUID
>>>>> as the key for each skill:
>>>>>
>>>>> skills: {
>>>>>   '4b27c2b3ac48e8df': 'java',
>>>>>   '84bf94ea7bc92018': 'c++',
>>>>>   '9103b9a93ce9d18': 'cobol'
>>>>> }
>>>>>
>>>>> Is this a good way of handling lists in Cassandra?  I imagine there's
>>>>> some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>>> that case.  Though I'm still having some trouble understanding composite
>>>>> columns as they seem not to be completely documented yet.  Would this
>>>>> solution work with composite columns?
>>>>>
>>>>> Thanks,
>>>>> Ben
>>>>>
>>>>>
>>>>
>>>
>>
>
>
> --
> With kind regards,
>
> Robin Verlangen
> www.robinverlangen.nl
>
>

Re: How to store a list of values?

Posted by "R. Verlangen" <ro...@us2.nl>.
In this case you only neem the columns for values. You don't need the
column-values to hold multiple columns (the super-column principle). So a
normal CF would work.

2012/3/26 Ben McCann <be...@benmccann.com>

> Thanks for the reply Samal.  I did not realize that you could store a
> column with null value.  Do you know if this solution would work with
> composite columns?  It seems super columns are being phased out in favor of
> composites, but I do not understand composites very well yet.  I'm trying
> to figure out if there's any way to accomplish what you've suggested using
> Astyanax <https://github.com/Netflix/astyanax>.
>
> Thanks for the help,
> Ben
>
>
> On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:
>
>> plus it is fully compatible with CQL.
>> SELECT * FROM UserSkill WHERE KEY='ben';
>>
>>
>> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>>
>>> I would take simple approach. create one other CF "UserSkill"  with row
>>> key same as profile_cf key,
>>> In user_skill cf will add skill as column name and value null. Columns
>>> can be added or removed.
>>>
>>> UserProfile={
>>>   '*ben*'={
>>>    blah :blah
>>>    blah :blah
>>>    blah :blah
>>>  }
>>> }
>>>
>>> UserSkill={
>>>   '*ben*'={
>>>     'java':''
>>>     'cassandra':''
>>>   .
>>>   .
>>>   .
>>>   'linux':''
>>>   'skill':'infinity'
>>>
>>>  }
>>>
>>> }
>>>
>>>
>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com> wrote:
>>>
>>>> I have a profile column family and want to store a list of skills in
>>>> each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>> have knowledge of these formats, and so the data in the datastore would not
>>>> not human readable in CQL queries from the command line.  The other
>>>> solution I thought of would be to use a super column and put a random UUID
>>>> as the key for each skill:
>>>>
>>>> skills: {
>>>>   '4b27c2b3ac48e8df': 'java',
>>>>   '84bf94ea7bc92018': 'c++',
>>>>   '9103b9a93ce9d18': 'cobol'
>>>> }
>>>>
>>>> Is this a good way of handling lists in Cassandra?  I imagine there's
>>>> some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>> that case.  Though I'm still having some trouble understanding composite
>>>> columns as they seem not to be completely documented yet.  Would this
>>>> solution work with composite columns?
>>>>
>>>> Thanks,
>>>> Ben
>>>>
>>>>
>>>
>>
>


-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

Re: How to store a list of values?

Posted by samal <sa...@gmail.com>.
On Mon, Mar 26, 2012 at 9:20 PM, Ben McCann <be...@benmccann.com> wrote:

> Thanks for the reply Samal.
>


>  I did not realize that you could store a column with null value.
>
values can be null or any value like
[default@node] set hus['test']['wowq']='\{deeeee\'.de\;\}\+\^anything';
Value inserted.
Elapsed time: 4 msec(s).
[default@node]
[default@node]
[default@node] get hus['test'];
=> (column=wow, value={deeeee.de;}, timestamp=1332777722503000)
=> (column=wowq, value={deeeee'.de;}+^anything, timestamp=1332777767425000)
Returned 2 results.
Elapsed time: 65 msec(s).
[default@node]


>  Do you know if this solution would work with composite columns?  It seems
> super columns are being phased out in favor of composites, but I do not
> understand composites very well yet.
>
personally i have phased out Super Column year back, about CC didn't much
dig into it but know key and column name can be composite.

'ben'+'task1'={
   utf8+ascii:''
}


>  I'm trying to figure out if there's any way to accomplish what you've
> suggested using Astyanax <https://github.com/Netflix/astyanax>.
>
  this is the simplest approach, should work with every client available
since it is independent CF, here two call is required.


> Thanks for the help,
> Ben
>
>
> On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:
>
>> plus it is fully compatible with CQL.
>> SELECT * FROM UserSkill WHERE KEY='ben';
>>
>>
>> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>>
>>> I would take simple approach. create one other CF "UserSkill"  with row
>>> key same as profile_cf key,
>>> In user_skill cf will add skill as column name and value null. Columns
>>> can be added or removed.
>>>
>>> UserProfile={
>>>   '*ben*'={
>>>    blah :blah
>>>    blah :blah
>>>    blah :blah
>>>  }
>>> }
>>>
>>> UserSkill={
>>>   '*ben*'={
>>>     'java':''
>>>     'cassandra':''
>>>   .
>>>   .
>>>   .
>>>   'linux':''
>>>   'skill':'infinity'
>>>
>>>  }
>>>
>>> }
>>>
>>>
>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com> wrote:
>>>
>>>> I have a profile column family and want to store a list of skills in
>>>> each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>> have knowledge of these formats, and so the data in the datastore would not
>>>> not human readable in CQL queries from the command line.  The other
>>>> solution I thought of would be to use a super column and put a random UUID
>>>> as the key for each skill:
>>>>
>>>> skills: {
>>>>   '4b27c2b3ac48e8df': 'java',
>>>>   '84bf94ea7bc92018': 'c++',
>>>>   '9103b9a93ce9d18': 'cobol'
>>>> }
>>>>
>>>> Is this a good way of handling lists in Cassandra?  I imagine there's
>>>> some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>> that case.  Though I'm still having some trouble understanding composite
>>>> columns as they seem not to be completely documented yet.  Would this
>>>> solution work with composite columns?
>>>>
>>>> Thanks,
>>>> Ben
>>>>
>>>>
>>>
>>
>

Re: How to store a list of values?

Posted by Ben McCann <be...@benmccann.com>.
Thanks for the reply Samal.  I did not realize that you could store a
column with null value.  Do you know if this solution would work with
composite columns?  It seems super columns are being phased out in favor of
composites, but I do not understand composites very well yet.  I'm trying
to figure out if there's any way to accomplish what you've suggested using
Astyanax <https://github.com/Netflix/astyanax>.

Thanks for the help,
Ben


On Mon, Mar 26, 2012 at 8:46 AM, samal <sa...@gmail.com> wrote:

> plus it is fully compatible with CQL.
> SELECT * FROM UserSkill WHERE KEY='ben';
>
>
> On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:
>
>> I would take simple approach. create one other CF "UserSkill"  with row
>> key same as profile_cf key,
>> In user_skill cf will add skill as column name and value null. Columns
>> can be added or removed.
>>
>> UserProfile={
>>   '*ben*'={
>>    blah :blah
>>    blah :blah
>>    blah :blah
>>  }
>> }
>>
>> UserSkill={
>>   '*ben*'={
>>     'java':''
>>     'cassandra':''
>>   .
>>   .
>>   .
>>   'linux':''
>>   'skill':'infinity'
>>
>>  }
>>
>> }
>>
>>
>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com> wrote:
>>
>>> I have a profile column family and want to store a list of skills in
>>> each profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>> have knowledge of these formats, and so the data in the datastore would not
>>> not human readable in CQL queries from the command line.  The other
>>> solution I thought of would be to use a super column and put a random UUID
>>> as the key for each skill:
>>>
>>> skills: {
>>>   '4b27c2b3ac48e8df': 'java',
>>>   '84bf94ea7bc92018': 'c++',
>>>   '9103b9a93ce9d18': 'cobol'
>>> }
>>>
>>> Is this a good way of handling lists in Cassandra?  I imagine there's
>>> some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>>> columns, and so the solution I proposed above would seem quite awkward in
>>> that case.  Though I'm still having some trouble understanding composite
>>> columns as they seem not to be completely documented yet.  Would this
>>> solution work with composite columns?
>>>
>>> Thanks,
>>> Ben
>>>
>>>
>>
>

Re: How to store a list of values?

Posted by samal <sa...@gmail.com>.
plus it is fully compatible with CQL.
SELECT * FROM UserSkill WHERE KEY='ben';

On Mon, Mar 26, 2012 at 9:13 PM, samal <sa...@gmail.com> wrote:

> I would take simple approach. create one other CF "UserSkill"  with row
> key same as profile_cf key,
> In user_skill cf will add skill as column name and value null. Columns can
> be added or removed.
>
> UserProfile={
>   '*ben*'={
>    blah :blah
>    blah :blah
>    blah :blah
>  }
> }
>
> UserSkill={
>   '*ben*'={
>     'java':''
>     'cassandra':''
>   .
>   .
>   .
>   'linux':''
>   'skill':'infinity'
>
>  }
>
> }
>
>
> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com> wrote:
>
>> I have a profile column family and want to store a list of skills in each
>> profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
>> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>> have knowledge of these formats, and so the data in the datastore would not
>> not human readable in CQL queries from the command line.  The other
>> solution I thought of would be to use a super column and put a random UUID
>> as the key for each skill:
>>
>> skills: {
>>   '4b27c2b3ac48e8df': 'java',
>>   '84bf94ea7bc92018': 'c++',
>>   '9103b9a93ce9d18': 'cobol'
>> }
>>
>> Is this a good way of handling lists in Cassandra?  I imagine there's
>> some idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
>> columns, and so the solution I proposed above would seem quite awkward in
>> that case.  Though I'm still having some trouble understanding composite
>> columns as they seem not to be completely documented yet.  Would this
>> solution work with composite columns?
>>
>> Thanks,
>> Ben
>>
>>
>

Re: How to store a list of values?

Posted by samal <sa...@gmail.com>.
I would take simple approach. create one other CF "UserSkill"  with row key
same as profile_cf key,
In user_skill cf will add skill as column name and value null. Columns can
be added or removed.

UserProfile={
  '*ben*'={
   blah :blah
   blah :blah
   blah :blah
 }
}

UserSkill={
  '*ben*'={
    'java':''
    'cassandra':''
  .
  .
  .
  'linux':''
  'skill':'infinity'
 }

}


On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <be...@benmccann.com> wrote:

> I have a profile column family and want to store a list of skills in each
> profile.  In BigTable I could store a Protocol Buffer<http://code.google.com/apis/protocolbuffers/docs/overview.html>with a repeated field, but I'm not sure how this is typically accomplished
> in Cassandra.  One option would be to store a serialized Thrift<http://thrift.apache.org/>or protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
> have knowledge of these formats, and so the data in the datastore would not
> not human readable in CQL queries from the command line.  The other
> solution I thought of would be to use a super column and put a random UUID
> as the key for each skill:
>
> skills: {
>   '4b27c2b3ac48e8df': 'java',
>   '84bf94ea7bc92018': 'c++',
>   '9103b9a93ce9d18': 'cobol'
> }
>
> Is this a good way of handling lists in Cassandra?  I imagine there's some
> idiom I'm not aware of.  I'm using the Astyanax<https://github.com/Netflix/astyanax/wiki>client library, which only supports composite columns instead of super
> columns, and so the solution I proposed above would seem quite awkward in
> that case.  Though I'm still having some trouble understanding composite
> columns as they seem not to be completely documented yet.  Would this
> solution work with composite columns?
>
> Thanks,
> Ben
>
>