Created 08-15-2017 11:23 PM
While trying to use import-all-tables if i specify the target-dir , i'm getting the below error.
$ sqoop import-all-tables --connect jdbc:mysql://localhost/db --username root --target-dir 'alltables/data' -m 1 17/08/14 14:08:07 ERROR tool.BaseSqoopTool: Error parsing arguments for import-all-tables: 17/08/14 14:08:07 ERROR tool.BaseSqoopTool: Unrecognized argument: --target-dir 17/08/14 14:08:07 ERROR tool.BaseSqoopTool: Unrecognized argument: alltables/data 17/08/14 14:08:07 ERROR tool.BaseSqoopTool: Unrecognized argument: -m 17/08/14 14:08:07 ERROR tool.BaseSqoopTool: Unrecognized argument: 1
Appreciate any help.!!
Created 08-15-2017 11:26 PM
Please follow this official documentation of Sqoop.
--target-dir is not a valid option when using import-all-tables. Thus you cannot use this.
Created 08-15-2017 11:26 PM
Please follow this official documentation of Sqoop.
--target-dir is not a valid option when using import-all-tables. Thus you cannot use this.
Created 08-16-2017 04:00 PM
Checking the official documentation link here. they suggest that each table will create automatically a separate folder for the outcome to store the data in the default HDFS path for the user who perform the operation.
$ sqoop import-all-tables --connect jdbc:mysql://db.foo.com/corp $ hadoop fs -ls Found 4 items drwxr-xr-x - someuser somegrp 0 2010-04-27 17:15 /user/someuser/EMPLOYEES drwxr-xr-x - someuser somegrp 0 2010-04-27 17:15 /user/someuser/PAYCHECKS drwxr-xr-x - someuser somegrp 0 2010-04-27 17:15 /user/someuser/DEPARTMENTS drwxr-xr-x - someuser somegrp 0 2010-04-27 17:15 /user/someuser/OFFICE_SUPPLIES
Created 08-16-2017 05:12 PM
Thank you..!!
Yes. But when we are using only 'Import' instead of 'Import-all-tables', we can specify where to store the table, instead of the default HDFS path using --target-dir .
As per below code, the data is imported to the target directory specified.
sqoop import --connect jdbc:mysql://localhost/my_db --table EMP --username root --target-dir 'sqoopdata/emp' -m 1
Created 08-16-2017 05:39 PM
yes exactly you right but this is only in import as --export-dir for export operation 🙂 this how that works
Created 08-22-2017 04:20 AM
Hi Ramya
To import all tables in particular directory, Use --warehouse-dir <directory> instead of --target-dir <directory>
example:
sqoop import --connect jdbc:mysql://localhost/test --table test1 --username xxxxx -P --warehouse-dir /home/user/Desktop/sqoopdump -m 1
Created 08-28-2017 07:49 PM
Thank you @Nandish B Naidu..!!
The solution worked.