sqoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eric hernandez <eric.hard...@gmail.com>
Subject Free-form Query Imports Documentation JOIN ON
Date Fri, 09 Dec 2011 16:06:31 GMT
HI all,

This set of documentation does not work as advertised.

http://archive.cloudera.com/cdh/3/sqoop/SqoopUserGuide.html#_free_form_query_imports

If this query was meant to be run on MySQL, then MySQL breaks on the double
"==" on the JOIN ON clause.

Here is an example with two "=="

sqoop import --connect jdbc:mysql://localhost/world -m1 --username sqoop
--password sqoop --query 'SELECT a.Name,b.Language FROM City a JOIN
CountryLanguage b ON a.CountryCode == b.CountryCode  WHERE $CONDITIONS'
--target-dir /user/eric/worldjoin/

11/12/09 08:00:40 INFO manager.SqlManager: Executing SQL statement: SELECT
a.Name,b.Language FROM City a JOIN CountryLanguage b ON a.CountryCode ==
b.CountryCode  WHERE  (1 = 0)
11/12/09 08:00:40 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 '== b.CountryCode  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 '== b.CountryCode  WHERE
(1 = 0)' at line 1

And it works if you just use one "="

sqoop import --connect jdbc:mysql://localhost/world -m1 --username sqoop
--password sqoop --query 'SELECT a.Name,b.Language FROM City a JOIN
CountryLanguage b ON a.CountryCode = b.CountryCode  WHERE $CONDITIONS'
--target-dir /user/eric/worldjoin/

11/12/09 08:01:36 INFO manager.SqlManager: Executing SQL statement: SELECT
a.Name,b.Language FROM City a JOIN CountryLanguage b ON a.CountryCode =
b.CountryCode  WHERE  (1 = 0)
11/12/09 08:01:47 INFO mapreduce.ImportJobBase: Retrieved 30670 records.


-- 
Eric H.
<eric.hardway@gmail.com>

Mime
View raw message