Hi,

I'm trying to use sqoop import with the where argument in which I have to
use backticks when importing data from mysql. The original where clause is:
`primary` > 5

I have to escape the backticks and this requires escaping for the shell
which should work with \\\` but what when running :

sqoop import --connect
"jdbc:mysql://address=(protocol=tcp)(host=...)(port=...)/...?allowMultiQueries=true&rewriteBatchedStatements=true&useCompression=true&useServerPrepStmts=false&zeroDateTimeBehavior=convertToNull"
--username "..." --password "..." --as-avrodatafile --compress --outdir
/tmp/.../ --table "test" --null-string "" --null-non-string "" --verbose
--columns "primary, field2, ..."  --where "\\\`primary\\\`>5"

I get the error:

ERROR security.UserGroupInformation: PriviledgedActionException as:hdfs
cause:java.io.IOException:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '\`primary\`>5 )' at line 1

How should I escape backticks here?


Thanks,

Ron

Reply via email to