Support Questions

Find answers, ask questions, and share your expertise

Sqoop import failing importing a simple table from mysql using where clause

Please find the attached for the error screen grabscreen-shot-2016-04-27-at-082448.png

Sqoop Query :

sqoop import --driver com.mysql.jdbc.Driver --connect jdbc:mysql://sandbox.hortonworks.com/test --username root -P --m 1 --query "select empid, ename from emp WHERE '$CONDITIONS' AND eid > '200' " --target-dir /user/maria_dev

1 ACCEPTED SOLUTION

Rising Star

hi, correct syntax is:

select empid, ename from emp WHERE eid > '200' and $CONDITIONS (no ' ' on $CONDITIONS)

View solution in original post

5 REPLIES 5

Rising Star

hi, correct syntax is:

select empid, ename from emp WHERE eid > '200' and $CONDITIONS (no ' ' on $CONDITIONS)

@Alessio Ubaldi : Thanks the query has started but its still failing. I guess I am still missing something. screen-shot-2016-04-27-at-092033.png

Rising Star

Can you attach all log?

By the way I think the problem is --target-dir:

use /user/root/test

For 2 reason:

1) Have permission to write with root user on /user/maria_dev? Default no.

2) target-dir must not exist, or job have this error: ERROR tool.ImportTool: Encountered IOException running import job: org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://sandbox.hortonworks.com:8020/user/root/test already exists

It worked Thanks

Rising Star

you are welcome