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 , delimiter is tab , however default delimiter in hive is "\000" (ctrl-a character)
No comments:
Post a Comment