Cloud Computing - Sqoop

Back to Course

Lesson Description

Lession - #794 Sqoop Export

This part depicts how to export information back from the HDFS to the RDBMS database. The objective table should exist in the objective database. The documents which are given as contribution to the Sqoop contain records, which are called columns in table. Those are perused and parsed into a bunch of records and delimited with client determined delimiter.

The default activity is to embed all the record from the info documents to the information base table utilizing the INSERT explanation. In update mode, Sqoop creates the UPDATE articulation that replaces the current record into the data set.


Below is the syntax for export command
$ sqoop export (generic-args>
$ sqoop-export (generic-args>


Allow us to take an illustration of the employee information in record, in HDFS. The employees information is accessible in employee_data record in 'emp/' catalog in HDFS. The employee_data is as per the following.
101, Jyoti, manager, 60000, AC
102, laxmi, python dev, 60000, TP
103, roopa, .NET dev, 40000, TP
104, deepa, .NET dev, 30000, AC
105, komal, admin, 10000, TP
Below query for create the table employees in Mysql command line.
$ mysql
mysql> USE db;
mysql> CREATE TABLE employees ( 
   emp_name VARCHAR(20>
, emp_deg VARCHAR(20>
, salary INT, dept VARCHAR(10>
The accompanying order is utilized to export the table information (which is in employee_data record on HDFS>
to the employees table in db database of Mysql database server.
$ sqoop export \
--connect jdbc:mysql://localhost/db \
--username root \
--table employees \ 
--export-dir /employees/employee_data
Below command verify the table in Mysql command line.
mysql>select * from employees;
In the event that the given information is put away effectively, you can track down the accompanying table of given employees information.
| Id   | Emp_Name     |Designation  |    Salary        | Dept   |
| 101 | Jyoti        | manager     | 60000             | AC     |
| 102 | laxmi        | python dev  | 60000             | TP     |
| 103 | roopa        | .NET dev    | 40000             | TP     |
| 104 | deepa        | .NET dev    | 30000             | AC     |
| 105 | komal        | admin       | 10000             | TP     |