You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by shree <sa...@lntinfotech.com> on 2014/05/14 09:11:04 UTC

Appending Data into an exsting Hbase Table using Pig

Hi,

I'm using Hbase 0.94.15-cdh4.6.0 version. I wanted to load data from HDFS to
HBASE. I have written PIG script to load the data from HDFS to HBASE wich is
working fine.
Below is the folder structure of HDFS:

-rw-r--r--   1 user supergroup         43 2014-05-14 16:49
dataparse/badrec_051420141648
-rw-r--r--   1 user supergroup         43 2014-05-14 16:49
dataparse/badrec_051420141649
-rw-r--r--   1 user supergroup         43 2014-05-14 16:50
dataparse/badrec_051420141650
-rw-r--r--   1 user supergroup        131 2014-05-14 16:49
dataparse/goodrec_051420141648
-rw-r--r--   1 user supergroup        131 2014-05-14 16:49
dataparse/goodrec_051420141649
-rw-r--r--   1 user supergroup        131 2014-05-14 16:50
dataparse/goodrec_051420141650


Here i wanted to add
goodrec_051420141648,goodrec_051420141649,goodrec_051420141650 files into a
single hbase table.
So i have created hbase table and using pig script i have added
goodrec_051420141648 file. In hbase shell m able to see the data in hbase
table. Now i wanted to append rest of the goodrec files into the same hbase
table without overwritten an existing data.How can i do it using pig script?
Below is the pig script :
G = LOAD '/user/user/dataparse/goodrec_051420141648' USING PigStorage(',')
as (c1:chararray, c2:chararray,c3:chararray,c4:chararray,c5:chararray);
STORE G INTO 'hbase://gooddata' USING
org.apache.pig.backend.hadoop.hbase.HBaseStorage('good:name good:state
good:phone_no good:gender'); 


To append the 2nd file i used the same pig scrpit  with file name
goodrec_051420141649. When i do this in my hbase table the existing data is
overwritten by the new data. But i wanted to append the data. How can i do
this ?
Note : Also i future in my hdfs directory the goodrec files are keep on
coming coming from the external system. In that time also i should be able
to add those files into a hbase table.

How can i do this?

Thanks,
Shree





--
View this message in context: http://apache-hbase.679495.n3.nabble.com/Appending-Data-into-an-exsting-Hbase-Table-using-Pig-tp4059086.html
Sent from the HBase User mailing list archive at Nabble.com.