Support Questions

Find answers, ask questions, and share your expertise

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

avatar
Rising Star

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

avatar
Expert Contributor

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

avatar
Expert Contributor

hi, correct syntax is:

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

avatar
Rising Star

@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

avatar
Expert Contributor

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

avatar
Rising Star

It worked Thanks

avatar
Expert Contributor

you are welcome