Josef Kafka Josef Kafka - 8 days ago 6
SQL Question

Sqoop fails to import any rows

I'm trying to import a dummy table (cities) into HDFS with the following command:

$ sqoop import --connect jdbc:oracle:thin:@10.0.2.15:1521/XE --username system --password root --table cities --columns country,city --split-by id --target-dir /sqoop/output1


but no rows get imported.

The SQL statement that gets generated by Sqoop is

SELECT t.* FROM cities t WHERE 1=0


which is odd because 1 will never be equal to zero.

I'm running:

Hadoop 2.4.1
Sqoop 1.4.5

Answer

The statement with "where 1=0" is generated just to get the list of columns. The actual select is done in the MR job later on.

The problem was that the "cities" table didn't belong to SYSTEM user.