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

Switch to Threaded View
HBase, mail # user - Regarding Rowkey and Column Family


Copy link to this message
-
Fw: Regarding Rowkey and Column Family
varaprasad.bheri@... 2012-12-27, 07:19
Hi,

For the below, may I insert into 'Customer' hbase table in the following way:

put 'Customer', 'rowkey', 'cf:json',
'{"Customer": {"Customer Detail":[{"CustomerNumber": "10000000001","DOB": "01/01/01","Fname": "Fname1","Mname":"Mname1","Lname": "Lname1","address": {"AddressType": "Home","AddressLine1" :"1.1.Address Line1",
"AddressLine2" :"1.1.Address Line2","AddressLine3" :"1.1.Address Line3","AddressLine4" :"1.1.Address Line4","State" :"1.1.State","City" :"1.1.City","Country" :"1.1.Country"}},{ "CustomerNumber": "10000000002","DOB": "01/02/01","Fname": "Fname2","Mname": "Mname2","Lname": "Lname2","address": [{"AddressType": "Home","AddressLine1" :"2.1.Address Line1","AddressLine2" :"2.1.Address Line2","AddressLine3" :"2.1.Address Line3","AddressLine4" :"2.1.Address Line4","State" :"2.1.State","City" :"2.1.City","Country" :"2.1.Country"},{"AddressType": "Office","AddressLine1" :"2.2.Address Line1","AddressLine2" :"2.2.Address Line2","AddressLine3" :"2.2.Address Line3",
"AddressLine4" :"2.2.Address Line4","State" :"2.2.State","City" :"2.2.City","Country" :"2.2.Country"}]},{"CustomerNumber": "10000000003","DOB": "01/03/01","Fname": "Fname3","Mname": "Mname3","Lname": "Lname3","address": [{"AddressType": "Home","AddressLine1" :"3.1.Address Line1","AddressLine2" :"3.1.Address Line2","AddressLine3" :"3.1.Address Line3","AddressLine4" :"3.1.Address Line4","State" :"3.1.State","City" :"3.1.City","Country" :"3.1.Country"},{"AddressType": "Office","AddressLine1" :"3.2.Address Line1","AddressLine2" :"3.2.Address Line2","AddressLine3" :"3.2.Address Line3","AddressLine4" :"3.2.Address Line4","State" :"3.2.State","City" :"3.2.City","Country" :"3.2.Country"},{"AddressType": "Others","AddressLine1" :"3.3.Address Line1","AddressLine2" :"3.3.Address Line2","AddressLine3" :"3.3.Address Line3","AddressLine4" :"3.3.Address Line4","State" :"3.3.State","City" :"3.3.City","Country" :"3.3.Country"}]},{"CustomerNumber": "10000000004","DOB": "01/04/01","Fname": "Fname4","Mname": "Mname4","Lname": "Lname4","address": [{"AddressType": "Home","AddressLine1" :"4.1.Address Line1","AddressLine2" :"4.1.Address Line2","AddressLine3" :"4.1.Address Line3","AddressLine4" :"4.1.Address Line4","State" :"4.1.State","City" :"4.1.City","Country" :"4.1.Country"},{"AddressType": "Office","AddressLine1" :"4.2.Address Line1","AddressLine2" :"4.2.Address Line2","AddressLine3" :"4.2.Address Line3","AddressLine4" :"4.2.Address Line4","State" :"4.2.State","City" :"4.2.City","Country" :"4.2.Country"},{"AddressType": "Office2","AddressLine1" :"4.3.Address Line1","AddressLine2" :"4.3.Address Line2","AddressLine3" :"4.3.Address Line3","AddressLine4" :"4.3.Address Line4","State" :"4.3.State","City" :"4.3.City","Country" :"4.3.Country"},{"AddressType": "Others","AddressLine1" :"4.4.Address Line1","AddressLine2" :"4.4.Address Line2","AddressLine3" :"4.4.Address Line3","AddressLine4" :"4.4.Address Line4","State" :"4.4.State","City" :"4.4.City","Country" :"4.4.Country"}]}]}}'

The scan of Customer table gives:

hbase(main):009:0> scan 'Customer'
ROW                              COLUMN+CELL
 rowkey                          column=cf:json, timestamp=1356583865944, value={"Customer": {"Customer Detail": [{"CustomerNumber": "10000000001","DOB": "01/01/01","Fname": "Fname1","Mname":"Mname1","Lname": "Lname1"
                                 ,"address": {"AddressType": "Home","AddressLine1" :"1.1.Address Line1", \x0A"AddressLine2" :
                                 "1.1.Address Line2","AddressLine3" :"1.1.Address Line3","AddressLine4" :"1.1.Address Line4",
                                 "State" :"1.1.State","City" :"1.1.City","Country" :"1.1.Country"}},{ "CustomerNumber": "1000
                                0000002","DOB": "01/02/01","Fname": "Fname2","Mname": "Mname2","Lname": "Lname2","address":[{"AddressType": "Home","AddressLine1" :"2.1.Address Line1","AddressLine2" :"2.1.Address Lin
                                 e2","AddressLine3" :"2.1.Address Line3","AddressLine4" :"2.1.Address Line4","State" :"2.1.St
                                 ate","City" :"2.1.City","Country" :"2.1.Country"},{"AddressType": "Office","AddressLine1" :"
                                 2.2.Address Line1","AddressLine2" :"2.2.Address Line2","AddressLine3" :"2.2.Address Line3",\
                                 x0A"AddressLine4" :"2.2.Address Line4","State" :"2.2.State","City" :"2.2.City","Country" :"2
                                 .2.Country"}]},{"CustomerNumber": "10000000003","DOB": "01/03/01","Fname": "Fname3","Mname":
                                  "Mname3","Lname": "Lname3","address": [{"AddressType": "Home","AddressLine1" :"3.1.Address
                                 Line1","AddressLine2" :"3.1.Address Line2","AddressLine3" :"3.1.Address Line3","AddressLine4
                                 " :"3.1.Address Line4","State" :"3.1.State","City" :"3.1.City","Country" :"3.1.Country"},{"A
                                 ddressType": "Office","AddressLine1" :"3.2.Address Line1","AddressLine2" :"3.2.Address Line2
                                 ","AddressLine3" :"3.2.Address Line3","AddressLine4" :"3.2.Address Line4","State" :"3.2.Stat
                                 e","City" :"3.2.City","Country" :"3.2.Country"},{"AddressType": "Others","AddressLine1" :"3.
                                 3.Address Line1","AddressLine2" :"3.3.Address Line2","AddressLine3" :"3.3.Address Line3","Ad
                                 dressLine4" :"3.3.Address Line4","State" :"3.3.State","City" :"3.3.City","Country" :"3.3.Cou
                                 ntry"}]},{"CustomerNumber": "10000000004","DOB": "01/04/01","Fname": "Fname4","Mname": "Mnam
                                 e4","Lname": "Lname4","address": [{"AddressType": "Home","AddressLine1" :"4.1.Address Line1"
                                 ,"AddressLine2" :"4.1.Address Line2","AddressLine3" :"4.1.Address Line3","AddressLine4" :"4.
                                 1.Address Line4","State" :"4.1.State","City" :