Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - hbase many-to-many design


Copy link to this message
-
Re: hbase many-to-many design
Sonal Goyal 2012-08-24, 04:53
Sorry, is this what you want? I created a table with two column families. I
added one row and column family cf1 with qualifier team1. Then I added new
team cf1 with qualifier team2.

hbase(main):001:0> create 'multi','cf1','cf2'
0 row(s) in 1.6240 seconds

hbase(main):002:0> put 'multi','row1','cf1:team1','firstTeam'
0 row(s) in 0.0880 seconds

hbase(main):003:0> scan 'multi'
ROW                   COLUMN+CELL

 row1                 column=cf1:team1, timestamp=1345783824219,
value=firstTeam
1 row(s) in 0.0540 seconds

hbase(main):004:0> put 'multi','row1','cf1:team2','secondTeam'
0 row(s) in 0.0060 seconds

hbase(main):005:0> scan 'multi'
ROW                   COLUMN+CELL

 row1                 column=cf1:team1, timestamp=1345783824219,
value=firstTeam
 row1                 column=cf1:team2, timestamp=1345783846821,
value=secondTea
                      m

1 row(s) in 0.0250 seconds
Best Regards,
Sonal
Crux: Reporting for HBase <https://github.com/sonalgoyal/crux>
Nube Technologies <http://www.nubetech.co>

<http://in.linkedin.com/in/sonalgoyal>

On Fri, Aug 24, 2012 at 10:03 AM, jing wang <[EMAIL PROTECTED]>wrote:

> Hi Sonal,
>
>    Thanks for your reply.
>    How to add a new column to the existing columnFamily?The method I want
> to try is using 3 steps, first get the record, construct a new put, using
> the reocrd's( getted before) columnFamily2, then delete the old record in
> Hbase, finally put the new constructed 'put' into Hbase.I really don't
> think this is a good way.
>    if another 'put', including a new column is put to Hbase, this is a
> 'update' action or another version?
>    Would you please give me some reference for adding a column to a row?
>
> Thanks & Best Regards
> Mike
>
>
> 2012/8/24 Sonal Goyal <[EMAIL PROTECTED]>
>
> > If you are you adding a new column to the team column family, I dont
> think
> > multi version comes into picture. Multi Versioning is saving copies of
> > values of a particular cell, but you are creating a new cell within the
> > same row.
> >
> >
> > Best Regards,
> > Sonal
> > Crux: Reporting for HBase <https://github.com/sonalgoyal/crux>
> > Nube Technologies <http://www.nubetech.co>
> >
> > <http://in.linkedin.com/in/sonalgoyal>
> >
> >
> >
> >
> >
> > On Fri, Aug 24, 2012 at 8:07 AM, jing wang <[EMAIL PROTECTED]
> > >wrote:
> >
> > > Hi 'user',
> > >
> > >      This is a many-to-many question, I also infer the hbase design
> FAQ,
> > > http://wiki.apache.org/hadoop/Hbase/FAQ_Design.
> > >      What I want to do is desinging a 'user' table, incluing 'user'
> basic
> > > infomations(columnFamily1), and team-name 'user' joined
> > in(columnFamily2),
> > >      When a user join in a new Team, I want to update the 'user' table
> to
> > > add a column to 'columnFamily2'. So when getting the user , I get all
> the
> > > team-names the user join in.
> > >      Yet I don't want to put duplicate records, known as
> multi-versions,
> > > each user has only one record.
> > >      What should I do?
> > >
> > >     Any advice will be appreciated!
> > >
> > >
> > > Thanks & Best Regards
> > > Mike
> > >
> >
>