The “sqoop export” command is used to export data from Hadoop to a relational database.
The execution flow of “sqoop export” can be described as follows:
- First, Sqoop establishes a connection to the source database and fetches the data that needs to be exported. The data can be filtered, transformed or sorted using various Sqoop options.
- The data is then converted to the format specified in the “–input-fields-terminated-by” option or “–input-lines-terminated-by” option. The default delimiter is a comma.
- Next, Sqoop creates a MapReduce job to write the data to the target database.
- The MapReduce job uses the DBOutputFormat class to write the data to the target database. The DBOutputFormat class provides the necessary interfaces to connect to the database and write the data.
- The MapReduce job is executed, and the data is written to the target database.
- Finally, Sqoop closes the connection to the source and target databases