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.
Created on 11-10-2019 09:52 PM - edited 11-10-2019 09:56 PM
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
Created 11-10-2019 11:03 PM
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
Created 11-10-2019 11:12 PM
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
Created 11-11-2019 12:22 PM
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