Support Questions
Find answers, ask questions, and share your expertise

please help with SQOOP IMPORT

Solved Go to solution

please help with SQOOP IMPORT

Explorer

Hello Guys,

I am having trouble with my query below. Searched a lot on the internet but nothing helped. Please help me understand where the issue is

sqoop import \
--connect jdbc:mysql://10.0.0.24/hive_data \
--username root -P \
--query 'select d.driverid, d.name, SUM(t.hours_logged) as hours from driver d JOIN timesheet t on (d.driverid = t.driverid) group by d.driverid,d.name Where $CONDITIONS' --split-by d.driverid \
--target-dir /home/hadoop/sqoop \
--driver com.mysql.jdbc.Driver

The error I get is below

SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
17/07/20 01:48:14 INFO manager.SqlManager: Executing SQL statement: select d.driverid, d.name, SUM(t.hours_logged) as hours from driver d JOIN timesheet t on (d.driverid = t.driverid) group by d.driverid,d.name Where  (1 = 0)
17/07/20 01:48:14 ERROR manager.SqlManager: Error executing statement: 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 'Where  (1 = 0)' at line 1
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 'Where  (1 = 0)' at line 1

please help

1 ACCEPTED SOLUTION

Accepted Solutions

Re: please help with SQOOP IMPORT

@Harjinder Brar

Mysql statement construction is not correct where should be before group by like this:

--query 'select d.driverid, d.name, SUM(t.hours_logged) as hours from driver d JOIN timesheet t on (d.driverid = t.driverid) Where $CONDITIONS group by d.driverid,d.name'

This should fix the issue.

Thanks

View solution in original post

3 REPLIES 3

Re: please help with SQOOP IMPORT

@Harjinder Brar

Mysql statement construction is not correct where should be before group by like this:

--query 'select d.driverid, d.name, SUM(t.hours_logged) as hours from driver d JOIN timesheet t on (d.driverid = t.driverid) Where $CONDITIONS group by d.driverid,d.name'

This should fix the issue.

Thanks

View solution in original post

Re: please help with SQOOP IMPORT

Explorer

worked like a charm. thanks

Re: please help with SQOOP IMPORT

Np. Glad that it worked @Harjinder Brar