Now export data from hive table departments_hive01 in departments_hive02. While exporting, please note following. wherever there is a empty string it should be loaded as a null value in mysql.

Now export data from hive table departments_hive01 in departments_hive02. While exporting, please note following. wherever there is a empty string it should be loaded as a null value in mysql.

wherever there is -999 value for int field, it should be created as null value.

Answer: Solution:

Step 1: Create table in mysql db as well.

mysql ~user=retail_dba -password=cloudera

use retail_db

CREATE TABLE IF NOT EXISTS departments_hive02(id int, department_name varchar(45), avg_salary int);

show tables;

Step 2: Now export data from hive table to mysql table as per the requirement.

sqoop export –connect jdbc:mysql://quickstart:3306/retail_db

-username retaildba

-password cloudera

–table departments_hive02

-export-dir /user/hive/warehouse/departments_hive01

-input-fields-terminated-by ‘01’

–input-Iines-terminated-by ‘n’

–num-mappers 1

-batch

-Input-null-string ""

-input-null-non-string -999

step 3: Now validate the data, select * from departments_hive02;

Latest CCA175 Dumps Valid Version with 96 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments