0
votes

I want use shell execute sqoop(1.4.5) command.

shell: sqoop_cmd="sqoop import --connect jdbc:mysql://xx.x.xxx.xxx:3306/test --username test --password datagateway --query 'select t.name from table_name t where date(hrc.gmt_modified) = date_sub(curdate(),interval 1 day) AND $CONDITIONS' --target-dir /output -m 1 --append"

result=$sqoop_cmd 2>&1 | grep -c "successfully"

error: WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.

But I updated --query to --table and remove ' AND $CONDITIONS' param try again, The sqoop command result is successfull. I think the question about '$', but I try '\$CONDITIONS', "'$CONDITIONS'", it's unsuccessfull.

please help me, thank you so much!

2

2 Answers

1
votes

this error is cause because

error: WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.

you are entering your database password in the command itself like this --password datagateway, instead if you have written like this -P you won't get that warning and password will be prompted after you start executing the command

0
votes

When you use --query parameter you have to use $CONDITION and you did it. But you forgot to add --split-by parameter that is obligatory: From sqoop user guide:
"Your query must include the token $CONDITIONS which each Sqoop process will replace with a unique condition expression. You must also select a splitting column with --split-by."

Hope it helps a bit.
Pawel