I am trying to export data from mssql server to hive. I am using following command to export data from Users table to hive.
sqoop import --connect "jdbc:sqlserver://{ip}\LOCAL_INSTANCE;database=TEST_DB;user=sa;password=****" --table "Users_Table" --create-hive-table --hive-table users_export --target-dir /cdc/export/users --append --query "select * from Users_Table"
I am getting following error message.
At minimum, you must specify --connect and --table Arguments to mysqldump and other subprograms may be supplied after a '--' on the command line.
If I remove --query param it uses default query to export data and it works fine.
I have also tried out -e parameter still getting the same error.
What could be the problem here?
Whenever you use --query attribute. you can't mention --table attribute in sqoop command. because you are already mentioning it in the FROM clause of query parameter.
You can use below command to use --query attribute
sqoop import --connect jdbc:db2://<IP_ADDR:<PORT>/<DB> --username user_name -P -m 1 --query "Select * from TABLE_NAME WHERE \$CONDITIONS AND ID = '16279320'" --target-dir /user/user_name
where $CONDITIONS is mandatory