In previous cases, flow of data was from RDBMs to HDFS. Using “export” tool, we can import data from HDFS to RDBMs. Before performing export, Sqoop fetches table metadata from MySQL database. Thus we first need to create a table with required metadata.
Table creation in MySQL
- mysql>Create table table_name( column_name column_type )
Export query is shown below:
- Sqoop query sqoop export \ –connect jdbc:mysql://localhost/cloudera\ –username cloudera -P \ –table exported \ –export-dir /user/country_imported/part-m-00000
Now, see output in MySQL by following code.
- mysql> select * from exported