Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C81EC9636 for ; Mon, 26 Mar 2012 15:43:42 +0000 (UTC) Received: (qmail 85564 invoked by uid 500); 26 Mar 2012 15:43:40 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 85529 invoked by uid 500); 26 Mar 2012 15:43:40 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 85521 invoked by uid 99); 26 Mar 2012 15:43:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 15:43:40 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of samalgorai@gmail.com designates 74.125.82.172 as permitted sender) Received: from [74.125.82.172] (HELO mail-we0-f172.google.com) (74.125.82.172) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 15:43:34 +0000 Received: by werb10 with SMTP id b10so5152718wer.31 for ; Mon, 26 Mar 2012 08:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=qwxnAwswAgSIX16yTsFI6BBulbCom1xOXNK+2gBq0ac=; b=Wzl5TMRdsN74gOQmP1Zur24J8DpgbboswYb3ol6zGQZaZSMA8EOa6mZZvPDfMAjtFD g0vRbOtOgHoSgRquLZ3CY9wdZny2hyMKl6boCtve86N71xTWffIs3YClwJneMOaM2vnx lPRER5+sZdkNAn04HXATarLSaVI6J4jGZ5TawrOeJ4TFDfJAQ8PTiRHYT/GwgXsffxGm RZix7PYBMxJiZtlg4n5kVtmVkPtqQ6km6sE6mwgSRMVjhuqXpSClFBHUX1xyHiDvbOfw cECgQ8ZSP4mlRmyzrHpnOLI5VllF8AdEtACOjF0V3O143O01Y5cvMGFww6hf+TXWzFKe ILNw== MIME-Version: 1.0 Received: by 10.216.138.5 with SMTP id z5mr13202505wei.27.1332776593739; Mon, 26 Mar 2012 08:43:13 -0700 (PDT) Received: by 10.223.103.16 with HTTP; Mon, 26 Mar 2012 08:43:13 -0700 (PDT) In-Reply-To: References: Date: Mon, 26 Mar 2012 21:13:13 +0530 Message-ID: Subject: Re: How to store a list of values? From: samal To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0016e6d644016f508104bc273b43 --0016e6d644016f508104bc273b43 Content-Type: text/plain; charset=UTF-8 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 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 Bufferwith a repeated field, but I'm not sure how this is typically accomplished > in Cassandra. One option would be to store a serialized Thriftor 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 Astyanaxclient 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 > > --0016e6d644016f508104bc273b43 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I would take simple approach. create one other CF "UserSkill"=C2= =A0 with row key same as profile_cf key,
In user_skill cf will add skil= l as column name and value null. Columns can be added or removed.

Us= erProfile=3D{
=C2=A0 'ben'=3D{
=C2=A0=C2=A0 blah :blah
=C2=A0=C2=A0 = blah :blah
=C2=A0=C2=A0 blah :blah
=C2=A0}
}

UserSkill=3D{<= br>=C2=A0 'ben'=3D{
=C2=A0=C2=A0=C2=A0 'java':= 9;'
=C2=A0=C2=A0=C2=A0 'cassandra':''
=C2=A0 .=C2=A0 .
=C2=A0 .
=C2=A0 'linux':''
=C2=A0 'skill':= 9;infinity'
=C2=A0}

}


O= n Mon, Mar 26, 2012 at 12:34 PM, Ben McCann <ben@benmccann.com> wrote:
I have a profile column family and want to s= tore a list of skills in each profile. =C2=A0In BigTable I could store a Protocol Buffer with a repeated field, but I'm not = sure how this is typically accomplished in Cassandra. =C2=A0One option woul= d be to store a serialized Thrift or protobuf, but I'd prefer not to do this as I beli= eve 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 comma= nd line. =C2=A0The other solution I thought of would be to use a super colu= mn and put a random UUID as the key for each skill:

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


Thanks,
Ben


--0016e6d644016f508104bc273b43--