AnsweredAssumed Answered

Sqoop error in 'conditions' clause

Question asked by piyushgodbole on Mar 2, 2018
Latest reply on Mar 5, 2018 by arjunkr
Branched to a new discussion

Hi all,


I am using sqoop1 script to load data from Oracle into hive. In the script, I am taking all the values related to Oracle db, listener and hive db details from user. Then I am using sqoop import statenent for actual import. In the query, I have added the '$conditions' in where clause. But still I am getting error that [${QUERY}] must contain '$conditions' in where clause. Any solution for this?


My sqoop import statement is


sqoop import --connect jdbc:oracle:thin:@${oracle_db_ip}:${oracle_sid_port}:${oracle_sid} --username '${username}' --password '${password}' --query '${QUERY}' --target-dir '${target_dir}' --m 1 --hive-import --hive-drop-import-delims --hive-table '${hive_db_name}.${hive_table_name}'


And I am getting the following error:


Warning: /opt/mapr/sqoop/sqoop-1.4.6/bin/../../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
18/03/03 01:41:39 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-mapr-1703
18/03/03 01:41:39 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
18/03/03 01:41:39 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
18/03/03 01:41:39 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/mapr/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/mapr/hive/hive-2.1/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
18/03/03 01:41:39 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
18/03/03 01:41:39 INFO manager.SqlManager: Using default fetchSize of 1000
18/03/03 01:41:39 INFO tool.CodeGenTool: Beginning code generation
18/03/03 01:41:39 ERROR tool.ImportTool: Encountered IOException running import job: Query [${QUERY}] must contain '$CONDITIONS' in WHERE clause.
at org.apache.sqoop.manager.ConnManager.getColumnTypes(
at org.apache.sqoop.orm.ClassWriter.getColumnTypes(
at org.apache.sqoop.orm.ClassWriter.generate(
at org.apache.sqoop.tool.CodeGenTool.generateORM(
at org.apache.sqoop.tool.ImportTool.importTable(
at org.apache.sqoop.Sqoop.runSqoop(
at org.apache.sqoop.Sqoop.runTool(
at org.apache.sqoop.Sqoop.runTool(
at org.apache.sqoop.Sqoop.main(


I cannot post my query here but the query starts with " and ends with

from table_name where '\$CONDITIONS'"


So, am I getting anything wrong here? What can be the solution?


Thanks in advance,

Piyush Godbole