4

I have seen Sqoop allows one to import data from an RDBMS database into HDFS. I however want to import data into local file system folders in Linux and NOT into HDFS file system.

Is there a way to do this?

Syed Nasar
  • 43
  • 1
  • 3

2 Answers2

3

In Sqoop1, you can use the "-fs" option as detailed in the documentation. Here's a quick example:

sqoop import -fs local -jt local --connect jdbc:mysql://<host>/sqoop --username sqoop --password sqoop --table tbl

In Sqoop2, you will be able to choose your file system when creating a link:

HDFS URI: file:///
generalpiston
  • 911
  • 7
  • 11
0

If you want to store the table in the directory from where sqoop it is invoked:

sqoop import -fs file:/// -jt local --connect jdbc://<host>/<database_name> --username <user_name> --password <password> --table <table_name>

the table will be stored as a csv file in ./

Antoni
  • 2,542
  • 20
  • 21