Support Questions
Find answers, ask questions, and share your expertise

sqoop import fails and shows

Highlighted

sqoop import fails and shows

Explorer

sqoop import --connect 'database' --username 'sa' -P --query 'select * from database.table where $CONDITIONS AND `date`= '11-11-2019' --split-by `date`--target-dir=user/hive/warehouse/stagging_tables/tablenew -m 1

 

Must specify destination with --target-dir.
Try --help for usage instructions.

4 REPLIES 4
Highlighted

Re: sqoop import fails and shows

Super Mentor

@Rak 

Looks like there no Space just before "--target-dir"  in your command "--split-by `date`--target-dir"

 

Can you give a single space before the target-dir as following and then try again. Also please check the target-dir PATH is valid. Means in your case looks like it has a missing forward slash like "user/hive" should be "/user/hive" ...etc

 

# sqoop import --connect 'database' --username 'sa' -P --query "select * from database.table where $CONDITIONS AND `date`= '11-11-2019'" --split-by `date` --target-dir=/user/hive/warehouse/stagging_tables/tablenew -m 1

 

 

Highlighted

Re: sqoop import fails and shows

Explorer

getting this error  how to get rid of this friends -- please help
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Error parsing arguments for import:
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: Nov
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 11
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 11:59:30
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: IST
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 2019
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: --target-dir
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: home/hduser2/
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: --append
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: --num-mappers
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 2

Highlighted

Re: sqoop import fails and shows

Explorer

QUERY:

sqoop import--connect 'jdbc:sqlserver'--username 'sa' -P--query "select * from dlyprice where
$CONDITIONS AND `date`= '2019-11-08'"--split-by `date--target-dir /home/hduser2 -m 2

ERROR:
getting this error how to get rid of this friends -- please help
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Error parsing arguments for import:
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: Nov
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 11
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 11:59:30
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: IST
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 2019
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: --target-dir
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: home/hduser2/
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: --append
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: --num-mappers
19/11/11 11:59:31 ERROR tool.BaseSqoopTool: Unrecognized argument: 2

Highlighted

Re: sqoop import fails and shows

Mentor

@Rak 

You have a couple of errors in your sqoop syntax but you are almost there, please have a look at the below hints and retry after understanding and correcting them.

1. Sqoop import--connect This is wrong you need a space between the import and -- ie sqoop import --connect
2. 'jdbc:sqlserver'--username is also not correct you need a port number and databases name ie "jdbc:sqlserver://<Server_Host>:<Server_Port>;databaseName"

3. The quotes around the '2019-11-08'" is wrong too
3. All you -- should have a space before

 

sqoop import--connect 'jdbc:sqlserver'--username 'sa' -P--query "select * from dlyprice where $CONDITIONS AND `date`= '2019-11-08'"--split-by `date--target-dir /home/hduser2 -m 2

 

Try something like this !

sqoop import --connect --connect "jdbc:sqlserver://<Server_Host>:<Server_Port>;DB_Name>" \
--driver com.microsoft.sqlserver.jdbc.SQLServerDriver \
--username XXXX -P --query "select * from dlyprice  where $CONDITIONS AND `date`= '2019-11-08' \
--split-by `date`  --target-dir /home/hduser2 -m 2

 

The above isn't tested by I wanted to highlight some of your mistakes by making it work makes you a better hadooper ! 

 

Here is a link to Sqoop User Guide

 

Can you try out this syntax remember to replace the values with that  of your environment

 

sqoop import --connect "jdbc:sqlserver://hostname;username='sa';password='sa_password';database=yourDB" --driver com.microsoft.sqlserver.jdbc.SQLServerDriver --query "select * from dlyprice where \$CONDITIONS" --split-by date -m 2 --target-dir /home/hduser2

 

Please revert