Now do the incremental import based on created_date column.
Answer: Solution:
Step 1: Login to musql db
mysql –user=retail_dba -password=cloudera
show databases;
use retail db; show tables;
Step 2: Create a table as given in problem statement.
CREATE table departments_new (department_id int(11), department_name varchar(45), createddate T1MESTAMP DEFAULT NOW());
show tables;
Step 3: isert records from departments table to departments_new insert into departments_new select a.", null from departments a;
Step 4: Import data from departments new table to hdfs.
sqoop import
-connect jdbc:mysql://quickstart:330G/retail_db
~username=retail_dba
-password=cloudera
-table departments_new
–target-dir /user/cloudera/departments_new
–split-by departments
Stpe 5: Check the imported data.
hdfs dfs -cat /user/cloudera/departmentsnew/part"
Step 6: Insert following 5 records in departmentsnew table.
Insert into departments_new values(110, "Civil", null);
Insert into departments_new values(111, "Mechanical", null);
Insert into departments_new values(112, "Automobile", null);
Insert into departments_new values(113, "Pharma", null);
Insert into departments_new values(114, "Social Engineering", null);
commit;
Stpe 7: Import incremetal data based on created_date column.
sqoop import
-connect jdbc:mysql://quickstart:330G/retaiI_db
-username=retail_dba
-password=cloudera
–table departments_new
-target-dir /user/cloudera/departments_new
-append
-check-column created_date
-incremental lastmodified
-split-by departments
-last-value "2016-01-30 12:07:37.0"
Step 8: Check the imported value.
hdfs dfs -cat /user/cloudera/departmentsnew/part"
Latest CCA175 Dumps Valid Version with 96 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund