Josef Kafka Josef Kafka - 1 year ago 79
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:@ --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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download