Regardless of these limitations, let's demonstrate that, in the right situations, we can use Sqoop to directly export data stored in Hive.
Remove any existing data in the employee table:
$ echo "truncate employees" | mysql –u hadoopuser –p hadooptest
You will receive the following response:
Query OK, 0 rows affected (0.01 sec)
Check the contents of the Hive warehouse for the employee table:
$ hadoop fs –ls /user/hive/warehouse/employees
You will receive the following response:
Found 1 items … /user/hive/warehouse/employees/part-m-00000
Perform the Sqoop export:
sqoop export --connect jdbc:mysql://10.0.0.100/hadooptest --username hadoopuser –P --table employees \ --export-dir /user/hive/warehouse/employees --input-fields-terminated-by '\001' --input-lines-terminated-by '\n'