Big Data Interview Questions and Answers- Sqoop
Last updated on Jun 15, 2020
2) sqoop job? ans : Sqoop job creates and saves the import and export commands. It specifies parameters to identify and recall the saved job. This re-calling or re-executing is used in the incremental import, which can import the updated rows from RDBMS table to HDFS.
3) command to execute a sqoop job? ans : sqoop job --exec myjob4) codegen in sqoop? ans : From the viewpoint of object-oriented application, every database table has one DAO class that contains ‘getter’ and ‘setter’ methods to initialize objects. This tool (-codegen) generates the DAO class automatically.It generates DAO class in Java, based on the Table Schema structure. The Java definition is instantiated as a part of the import process. The main usage of this tool is to check if Java lost the Java code. If so, it will create a new version of Java with the default delimiter between fields.
5) sqoop workflow in oozie? ans : <workflow-app name="sample-wf" xmlns="uri:oozie:workflow:0.1"> ... <action name="myfirsthivejob"> <sqoop xmlns="uri:oozie:sqoop-action:0.2"> <job-traker>foo:8021</job-tracker> <name-node>bar:8020</name-node> <prepare> <delete path="${jobOutput}"/> </prepare> <configuration> <property> <name>mapred.compress.map.output</name> <value>true</value> </property> </configuration> <command>import --connect jdbc:hsqldb:file:db.hsqldb --table TT --target-dir hdfs://localhost:8020/user/tucu/foo -m 1</command> </sqoop> <ok to="myotherjob"/> <error to="errorcleanup"/> </action> ... </workflow-app> (or) <workflow-app name="sample-wf" xmlns="uri:oozie:workflow:0.1"> ... <action name="myfirsthivejob"> <sqoop xmlns="uri:oozie:sqoop-action:0.2"> <job-traker>foo:8021</job-tracker> <name-node>bar:8020</name-node> <arg>import</arg> <arg>--connect</arg> <arg>jdbc:hsqldb:file:db.hsqldb</arg> <arg>--table</arg> <arg>TT</arg> <arg>--target-dir</arg> <arg>hdfs://localhost:8020/user/tucu/foo</arg> <arg>-m</arg> <arg>1</arg> </sqoop> <ok to="myotherjob"/> <error to="errorcleanup"/> </action> ... </workflow-app>6)import subset of tableDate? ans : sqoop import \ --connect jdbc:mysql://localhost/userdb \ --username root \ --table emp_add \ --m 1 \ --where “city =’sec-bad’” \ --target-dir /wherequery7) import incremental import? ans : sqoop import \ --connect jdbc:mysql://localhost/userdb \ --username root \ --table emp \ --m 1 \ --incremental append \ --check-column id \ -last value 1205