Created 07-20-2017 01:57 AM
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
Created 07-20-2017 02:57 AM
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
Created 07-20-2017 02:57 AM
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
Created 07-20-2017 03:04 AM
worked like a charm. thanks
Created 07-20-2017 03:06 AM
Np. Glad that it worked @Harjinder Brar