Below are some Sqoop Export Commands and Other Miscellaneous commands
It is nothing but exporting data from HDFS to database. To use ‘export‘ command, a table in database should already exist. then only export functionality in sqoop will works.
export command will works in two ways
1. insert: insert mode will insert the new records from HDFS to RDBMS table.
Note: if a record already present in the database table with same primary key, then it will raise MySQLIntegrityConstraintViolationException exception.
2. update: update mode will update the records in the RDBMS from HDFS data.
update mode only update already existing records, it will not insert new records in the RDBMS.
Job is nothing but to save a sqoop command and excute n times when we require it. The job command allows you to create and work with saved jobs. Saved jobs remember the parameters used to specify a job, so they can be re-executed by invoking the job by its handle.
The following are Sqoop Job commands,
There should be space between ‘–‘ and ‘import’.
list jobs: it will show all the jobs.
inspect job: it will show details about the job.
delete job: it will delete existing job.
execute job: it will execute the job.
Merge command in sqoop is to merge two existing tables in HDFS to single new table in HDFS.
Let us discuss merge functionality with the example:
The below are tables in RDBMS,
Table 1: emp_1
Table 2: emp_2
Importing emp_1 into HDFS
Importing emp_2 into HDFS
After importing emp_1 and emp_2 into HDFS, sqoop will generate a jar into our local file system. with help of that jar we will able to merge the two tables in HDFS
1. create a database and table as shown below