Appendix 7. Move Data (using Sqoop) from MySQL to HIVE
syntax:
sqoop import --connect jdbc:mysql://localhost/employees --username root --P --table departments --hive-import
to find out why it errors out:
so, let's do the big table employees
sqoop import --connect jdbc:mysql://localhost/employees --username root --P --table employees --hive-import
to find out:
hdfs dfs -ls hdfs://localhost:9000/user/root/employees
sqoop import --connect jdbc:mysql://localhost/employees --username root --P --table dept_emp --hive-import
verification
Note: only dept_emp is imported into Hive, the rest tables are imported into HDFS
To see the details in each Hive table:
hive> select * from dept_emp order by dept_no limit 10;
Note: the sequence cannot be wrong, e.g. the following query is wrong:
hive> select * from dept_emp limit 100 order by dept_no;