TECH SOLUTIONS

Click here to edit subtitle

Forums

Post Reply
Forum Home > Bigdata Learnings( Hadoop, HBase,Hive and other bigdata technologies) > SQOOP:Export Data from Hive to MySql

Sourav Gulati
Site Owner
Posts: 83

Following is an example hive table :

hive> select * from hbasetable;

OK

row-1    colfam1    quan1    val1

row-2    colfam1    quan2    val2

Time taken: 0.43 seconds

 

Before exporting data create a table into MySql that would have equivalent datatypes .

mysql>use testhadoop;

 

mysql> create table hbase_table(id varchar(10),colfam varchar(10),quan varchar(10),value varchar(10));

Query OK, 0 rows affected (0.15 sec)


So data will be exported to SQl from hive as follows:

$ $SQOOP_HOME/binsqoop export --connect jdbc:mysql://host-ip/testhadoop --table hbase_table --export-dir /user/hive/warehouse/hbasetable  --input-fields-terminated-by '\t';


Here , delimeter is tab , however default delimeter in hive is "\000" (ctrl-a character)




Click here for Other topics of BigData Technologies

 

 

February 22, 2013 at 1:34 PM Flag Quote & Reply

You must login to post.