Exam4Training

Now import only new inserted records and append to existring directory . which has been created in first step.

Now import only new inserted records and append to existring directory . which has been created in first step.

Answer: Solution:

Step 1: Clean already imported data. (In real exam, please make sure you dont delete data generated from previous exercise).

hadoop fs -rm -R departments

Step 2: Import data in departments directory.

sqoop import

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

–username=retail_dba

-password=cloudera

-table departments

"target-dir/user/cloudera/departments

Step 3: Insert the five records in departments table.

mysql -user=retail_dba –password=cloudera retail_db

Insert into departments values(10, "physics"); Insert into departments values(11, "Chemistry"); Insert into departments values(12, "Maths"); Insert into departments values(13, "Science"); Insert into departments values(14, "Engineering"); commit;

select’ from departments;

Step 4: Get the maximum value of departments from last import, hdfs dfs -cat /user/cloudera/departments/part* that should be 7

Step 5: Do the incremental import based on last import and append the results.

sqoop import

–connect "jdbc:mysql://quickstart.cloudera:330G/retail_db"

~username=retail_dba

-password=cloudera

-table departments

–target-dir /user/cloudera/departments

-append

-check-column "department_id"

-incremental append

-last-value 7

Step 6: Now check the result.

hdfs dfs -cat /user/cloudera/departments/part"

Latest CCA175 Dumps Valid Version with 96 Q&As

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

Exit mobile version