Import departments table as a text file in /user/cloudera/departments.

Import departments table as a text file in /user/cloudera/departments.

Answer: Solution:

Step 1: List tables using sqoop

sqoop list-tables –connect jdbc:mysql://quickstart:330G/retail_db –username retail dba -password cloudera

Step 2: Eval command, just run a count query on one of the table.

sqoop eval

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

-username retail_dba

-password cloudera

–query "select count(1) from ordeMtems"

Step 3: Import all the tables as avro file.

sqoop import-all-tables

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

-username=retail_dba

-password=cloudera

-as-avrodatafile

-warehouse-dir=/user/hive/warehouse/retail stage.db

-ml

Step 4: Import departments table as a text file in /user/cloudera/departments

sqoop import

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

-username=retail_dba

-password=cloudera

-table departments

-as-textfile

-target-dir=/user/cloudera/departments

Step 5: Verify the imported data.

hdfs dfs -Is /user/cloudera/departments

hdfs dfs -Is /user/hive/warehouse/retailstage.db

hdfs dfs -Is /user/hive/warehouse/retail_stage.db/products

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